From: Jerry D. Hedden Date: Thu, 9 Aug 2007 08:28:17 +0000 (-0400) Subject: Test '-x dir' X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=94e93a7aa11773f80f2c4abf1f3e9c73e11090bf;p=p5sagit%2Fp5-mst-13.2.git Test '-x dir' From: "Jerry D. Hedden" Message-ID: <1ff86f510708090528w5579515bp6f862c613abccf84@mail.gmail.com> p4raw-id: //depot/perl@31696 --- diff --git a/MANIFEST b/MANIFEST index c5acd01..06d4cb3 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3876,6 +3876,7 @@ t/run/switchPx.aux Data for switchPx.t t/run/switchPx.t Test the -Px combination t/run/switcht.t Test the -t switch t/run/switchx.aux Data for switchx.t +t/run/switchx2.aux Data for switchx.t t/run/switchx.t Test the -x switch t/TEST The regression tester t/TestInit.pm Preamble library for core tests diff --git a/t/run/switchx.aux b/t/run/switchx.aux index 576730c..bfb79e1 100644 --- a/t/run/switchx.aux +++ b/t/run/switchx.aux @@ -17,5 +17,14 @@ still not perl #!/some/path/that/leads/to/perl -l -print "1..1"; -print "ok 1"; +print "1..4"; +if (-f 'run/switchx.aux') { + print "ok 1"; +} +print "ok 2"; +# other tests are in switchx2.aux + +__END__ + +# This is ignored +print "not ok 2"; diff --git a/t/run/switchx.t b/t/run/switchx.t index 60a522c..1c61ba8 100644 --- a/t/run/switchx.t +++ b/t/run/switchx.t @@ -8,4 +8,13 @@ BEGIN { require './test.pl'; use File::Spec::Functions; -print runperl( switches => ['-x'], progfile => catfile(curdir(), 'run', 'switchx.aux') ); +# Test '-x' +print runperl( switches => ['-x'], + progfile => catfile(curdir(), 'run', 'switchx.aux') ); + +# Test '-xdir' +print runperl( switches => ['-x' . catfile(curdir(), 'run')], + progfile => catfile(curdir(), 'run', 'switchx2.aux'), + args => [ 3 ] ); + +# EOF diff --git a/t/run/switchx2.aux b/t/run/switchx2.aux new file mode 100644 index 0000000..c1fb6ee --- /dev/null +++ b/t/run/switchx2.aux @@ -0,0 +1,32 @@ +From: foo@bar.xx +Date: Jan 1, 2037 12:34 PM +Subject: Ignore mail header +To: perl@perl.xx + +#perl +Not perl + +#! +Still not perl + +#!/something/else +Still not perl + +#!/usr/bin/bash +# Ignore shell commands +if [[ -z $FOO ]]; then echo 'not ok 1'; fi + +#!/some/path/that/leads/to/perl -l + +# These lines get executed +my $test = $ARGV[0]; +if (-f 'switchx.t') { + print("ok $test"); +} +$test++; +print "ok $test"; + +__END__ + +# This is ignored +print "not ok $test";