This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test '-x dir'
authorJerry D. Hedden <jdhedden@cpan.org>
Thu, 9 Aug 2007 08:28:17 +0000 (04:28 -0400)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Thu, 9 Aug 2007 15:00:25 +0000 (15:00 +0000)
From: "Jerry D. Hedden" <jdhedden@cpan.org>
Message-ID: <1ff86f510708090528w5579515bp6f862c613abccf84@mail.gmail.com>

p4raw-id: //depot/perl@31696

MANIFEST
t/run/switchx.aux
t/run/switchx.t
t/run/switchx2.aux [new file with mode: 0644]

index c5acd01..06d4cb3 100644 (file)
--- 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
index 576730c..bfb79e1 100644 (file)
@@ -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";
index 60a522c..1c61ba8 100644 (file)
@@ -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 (file)
index 0000000..c1fb6ee
--- /dev/null
@@ -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";