This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix t/comp/parser_run.t for EBCDIC
[perl5.git] / t / comp / parser_run.t
CommitLineData
d7186add
HS
1#!./perl
2
3# Parser tests that want test.pl, eg to use runperl() for tests to show
4# reads through invalid pointers.
5# Note that this should still be runnable under miniperl.
6
7BEGIN {
d7186add 8 chdir 't' if -d 't';
1ce8be81
N
9 require './test.pl';
10 set_up_inc( qw(. ../lib ) );
d7186add
HS
11}
12
4efcdc02 13plan(5);
d7186add
HS
14
15# [perl #130814] can reallocate lineptr while looking ahead for
16# "Missing $ on loop variable" diagnostic.
bce4a2ab
HS
17my $result = fresh_perl(
18 " foreach m0\n\$" . ("0" x 0x2000),
19 { stderr => 1 },
d7186add 20);
bce4a2ab
HS
21is($result . "\n", <<EXPECT);
22syntax error at - line 3, near "foreach m0
d7186add 23"
bce4a2ab 24Identifier too long at - line 3.
d7186add
HS
25EXPECT
26
36000cd1 27fresh_perl_is(<<EOS, <<'EXPECT', {}, "linestart before bufptr");
faa9b9ce 28\${ \xB6eeeeeeeeeeee
36000cd1
TC
29'x
30EOS
faa9b9ce 31Unrecognized character \xB6; marked by <-- HERE after ${ <-- HERE near column 4 at - line 1.
36000cd1
TC
32EXPECT
33
3b8804a4
TC
34fresh_perl_is(<<'EOS', <<'EXPECTED', {}, "use after free (#131836)");
35${sub#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
36EOS
37Missing right curly or square bracket at - line 1, at end of line
38syntax error at - line 1, at EOF
39Execution of - aborted due to compilation errors.
40EXPECTED
41
1141a2c7
TC
42SKIP:
43{
44 # [perl #131949] use after free
45 # detected by ASAN
46 # Win32 cmd.exe can't handle newlines well
47 skip("Need POSIXish", 1) if $^O eq "MSWin32";
48 my $out = runperl(prog => "\@{ 0\n\n}", stderr => 1, non_portable => 1);
49 is($out, "", "check for ASAN use after free");
50}
51
4efcdc02
LM
52fresh_perl_is('-C-', <<'EXPECTED', {}, "ambiguous unary operator check doesn't crash (#132433)");
53Warning: Use of "-C-" without parentheses is ambiguous at - line 1.
54syntax error at - line 1, at EOF
55Execution of - aborted due to compilation errors.
56EXPECTED
57
d7186add
HS
58__END__
59# ex: set ts=8 sts=4 sw=4 et: