From: Nicholas Clark Date: Tue, 17 Feb 2009 22:57:56 +0000 (+0000) Subject: Tests for S_incpush_use_sep() splitting on : (or platform equivalent) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=72533a49cbed2661d6c2811089631bb401aef2c7;p=p5sagit%2Fp5-mst-13.2.git Tests for S_incpush_use_sep() splitting on : (or platform equivalent) --- diff --git a/t/run/runenv.t b/t/run/runenv.t index 9baf43c..1d2a6a7 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 {