From 77818208643949320ba57536d6c01e6973ff7a4a Mon Sep 17 00:00:00 2001 From: "Michael G. Schwern" Date: Thu, 15 Nov 2001 07:47:59 -0500 Subject: [PATCH] -x (was Re: [PATCH] new tests for command-line switches) Message-ID: <20011115124759.E31399@blackrider> p4raw-id: //depot/perl@13027 --- MANIFEST | 6 ++++-- t/run/switches.t | 23 +---------------------- t/run/switchx.aux | 21 +++++++++++++++++++++ t/run/switchx.t | 10 ++++++++++ 4 files changed, 36 insertions(+), 24 deletions(-) create mode 100644 t/run/switchx.aux create mode 100644 t/run/switchx.t diff --git a/MANIFEST b/MANIFEST index e83e681..07cee63 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2272,9 +2272,11 @@ t/run/exit.t Test perl's exit status. t/run/kill_perl.t Tests that kill perl. t/run/runenv.t Test if perl honors its environment variables. t/run/noswitch.t Test aliasing ARGV for other switch tests -t/run/switchp.t Test the -p switch -t/run/switchn.t Test the -n switch t/run/switcha.t Test the -a switch +t/run/switchn.t Test the -n switch +t/run/switchp.t Test the -p switch +t/run/switchx.t Test the -x switch +t/run/switchx.aux Data for switchx.t t/run/switchF.t Test the -F switch t/run/switches.t Tests for the other switches t/TEST The regression tester diff --git a/t/run/switches.t b/t/run/switches.t index 2d6645d..04b9630 100644 --- a/t/run/switches.t +++ b/t/run/switches.t @@ -9,7 +9,7 @@ BEGIN { require "./test.pl"; -plan(tests => 15); +plan(tests => 14); my $r; my @tmpfiles = (); @@ -159,24 +159,3 @@ SWTESTPM is( $r, '', '-m with import parameters' ); push @tmpfiles, $filename; } - -# Tests for -x - -$filename = 'swxtest.tmp'; -SKIP: { - open my $f, ">$filename" or skip( "Can't write temp file $filename: $!" ); - print $f <<'SWTEST'; -print 1; -#!perl -print 2; -__END__ -print 3; -SWTEST - close $f; - $r = runperl( - switches => [ '-x' ], - progfile => $filename, - ); - is( $r, '2', '-x' ); - push @tmpfiles, $filename; -} diff --git a/t/run/switchx.aux b/t/run/switchx.aux new file mode 100644 index 0000000..576730c --- /dev/null +++ b/t/run/switchx.aux @@ -0,0 +1,21 @@ +Some stuff that's not Perl + +This CPP directive should not be read. +#define BARMAR 1 + +#perl + +Still not perl. + +#! + +still not perl + +#!/something/else + +still not perl + +#!/some/path/that/leads/to/perl -l + +print "1..1"; +print "ok 1"; diff --git a/t/run/switchx.t b/t/run/switchx.t new file mode 100644 index 0000000..4676d1a --- /dev/null +++ b/t/run/switchx.t @@ -0,0 +1,10 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +require './test.pl'; + +print runperl( switches => ['-x'], progfile => 'run/switchx.aux' ); -- 2.7.4