summaryrefslogtreecommitdiff
path: root/t/run
diff options
context:
space:
mode:
Diffstat (limited to 't/run')
-rw-r--r--t/run/switchx.aux13
-rw-r--r--t/run/switchx.t11
-rw-r--r--t/run/switchx2.aux32
3 files changed, 53 insertions, 3 deletions
diff --git a/t/run/switchx.aux b/t/run/switchx.aux
index 576730c80a..bfb79e1509 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 60a522cf49..1c61ba89f1 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 0000000000..c1fb6ee65d
--- /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";