summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-02-17 22:57:56 +0000
committerNicholas Clark <nick@ccl4.org>2009-02-17 23:27:07 +0000
commit72533a49cbed2661d6c2811089631bb401aef2c7 (patch)
tree97abe8e420aeb0e4bfbd1ec1aedef771bc0379f0 /t
parentd5226c4c8f9a293280b320d06c082073daeb75b1 (diff)
downloadperl-72533a49cbed2661d6c2811089631bb401aef2c7.tar.gz
Tests for S_incpush_use_sep() splitting on : (or platform equivalent)
Diffstat (limited to 't')
-rw-r--r--t/run/runenv.t48
1 files changed, 47 insertions, 1 deletions
diff --git a/t/run/runenv.t b/t/run/runenv.t
index 9baf43cf24..1d2a6a7ece 100644
--- a/t/run/runenv.t
+++ b/t/run/runenv.t
@@ -15,7 +15,7 @@ BEGIN {
require './test.pl'
}
-plan tests => 17;
+plan tests => 75;
my $STDOUT = tempfile();
my $STDERR = tempfile();
@@ -189,6 +189,52 @@ try({PERL5LIB => "foo",
'',
'');
+# Tests for S_incpush_use_sep():
+
+my @dump_inc = ('-e', 'print "$_\n" foreach @INC');
+
+my ($out, $err) = runperl_and_capture({}, [@dump_inc]);
+
+is ($err, '', 'No errors when determining @INC');
+
+my @default_inc = split /\n/, $out;
+
+is (shift @default_inc, '../lib', 'Our -I../lib is at the front');
+
+my $sep = $Config{path_sep};
+foreach (['nothing', ''],
+ ['something', 'zwapp', 'zwapp'],
+ ['two things', "zwapp${sep}bam", 'zwapp', 'bam'],
+ ['two things, ::', "zwapp${sep}${sep}bam", 'zwapp', 'bam'],
+ [': at start', "${sep}zwapp", 'zwapp'],
+ [': at end', "zwapp${sep}", 'zwapp'],
+ [':: sandwich ::', "${sep}${sep}zwapp${sep}${sep}", 'zwapp'],
+ [':', "${sep}"],
+ ['::', "${sep}${sep}"],
+ [':::', "${sep}${sep}${sep}"],
+ ['two things and :', "zwapp${sep}bam${sep}", 'zwapp', 'bam'],
+ [': and two things', "${sep}zwapp${sep}bam", 'zwapp', 'bam'],
+ [': two things :', "${sep}zwapp${sep}bam${sep}", 'zwapp', 'bam'],
+ ['three things', "zwapp${sep}bam${sep}${sep}owww",
+ 'zwapp', 'bam', 'owww'],
+ ) {
+ my ($name, $lib, @expect) = @$_;
+ push @expect, @default_inc;
+
+ ($out, $err) = runperl_and_capture({PERL5LIB => $lib}, [@dump_inc]);
+
+ is ($err, '', "No errors when determining \@INC for $name");
+
+ my @inc = split /\n/, $out;
+
+ is (shift @inc, '../lib', 'Our -I../lib is at the front for $name');
+
+ is (scalar @inc, scalar @expect,
+ "expected number of elements in \@INC for $name");
+
+ is ("@inc", "@expect", "expected elements in \@INC for $name");
+}
+
# PERL5LIB tests with included arch directories still missing
END {