Commit | Line | Data |
---|---|---|
77818208 MS |
1 | #!./perl |
2 | ||
3 | BEGIN { | |
4 | chdir 't' if -d 't'; | |
5 | @INC = '../lib'; | |
6 | } | |
0644b51e | 7 | use strict; |
77818208 MS |
8 | |
9 | require './test.pl'; | |
10 | ||
94e93a7a JH |
11 | # Test '-x' |
12 | print runperl( switches => ['-x'], | |
519ecd2c | 13 | progfile => 'run/switchx.aux' ); |
94e93a7a JH |
14 | |
15 | # Test '-xdir' | |
519ecd2c NC |
16 | print runperl( switches => ['-x./run'], |
17 | progfile => 'run/switchx2.aux', | |
94e93a7a JH |
18 | args => [ 3 ] ); |
19 | ||
0644b51e NC |
20 | curr_test(5); |
21 | ||
22 | # Test the error message for not found | |
23 | like(runperl(switches => ['-x'], progfile => 'run/switchx3.aux', stderr => 1), | |
24 | qr/^No Perl script found in input\r?\n\z/, | |
25 | "Test the error message when -x can't find a #!perl line"); | |
26 | ||
27 | SKIP: { | |
28 | skip("These tests embed newlines in command line arguments, which isn't portable to $^O", 2) | |
29 | if $^O eq 'MSWin32' or $^O eq 'VMS'; | |
30 | my @progs = ("die;\n", "#!perl\n", "warn;\n"); | |
31 | is(runperl(progs => \@progs, stderr => 1, non_portable => 1), | |
32 | "Died at -e line 1.\n", 'Test program dies'); | |
33 | is(runperl(progs => \@progs, stderr => 1, non_portable => 1, | |
34 | switches => ['-x']), | |
35 | "No Perl script found in input\n", '-x and -e gives expected error'); | |
36 | } |