This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PATCH: [perl #126141]: qr/]]]]][\\/ fails to raise error
[perl5.git] / t / run / switchx.t
CommitLineData
77818208
MS
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
0644b51e 7use strict;
77818208
MS
8
9require './test.pl';
10
94e93a7a
JH
11# Test '-x'
12print runperl( switches => ['-x'],
519ecd2c 13 progfile => 'run/switchx.aux' );
94e93a7a
JH
14
15# Test '-xdir'
519ecd2c
NC
16print runperl( switches => ['-x./run'],
17 progfile => 'run/switchx2.aux',
94e93a7a
JH
18 args => [ 3 ] );
19
0644b51e
NC
20curr_test(5);
21
22# Test the error message for not found
23like(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
27SKIP: {
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}