xref: /openbsd-src/gnu/usr.bin/perl/t/lib/croak/toke (revision 3d61058aa5c692477b6d18acfbbdb653a9930ff9)
191f110e0Safresh1__END__
2b8851fccSafresh1# NAME foo found where operator expected
3b8851fccSafresh1myfunc 1,2,3
4b8851fccSafresh1EXPECT
5e0680481Safresh1Number found where operator expected (Do you need to predeclare "myfunc"?) at - line 1, near "myfunc 1"
6b8851fccSafresh1syntax error at - line 1, near "myfunc 1"
7b8851fccSafresh1Execution of - aborted due to compilation errors.
8b8851fccSafresh1########
9b8851fccSafresh1# NAME foo found where operator expected (after strict error, w/fatal warnings)
10b8851fccSafresh1use warnings FATAL => 'all';
11b8851fccSafresh1use strict;
12b8851fccSafresh1$foo;
13b8851fccSafresh1myfunc 1,2,3
14b8851fccSafresh1EXPECT
15b8851fccSafresh1Global symbol "$foo" requires explicit package name (did you forget to declare "my $foo"?) at - line 3.
16e0680481Safresh1Number found where operator expected (Do you need to predeclare "myfunc"?) at - line 4, near "myfunc 1"
17b8851fccSafresh1syntax error at - line 4, near "myfunc 1"
18b8851fccSafresh1Execution of - aborted due to compilation errors.
19b8851fccSafresh1########
20e0680481Safresh1# NAME (Missing operator before "${"?) [perl #123737]
21b8851fccSafresh10${
22b8851fccSafresh1EXPECT
23e0680481Safresh1Scalar found where operator expected (Missing operator before "${"?) at - line 1, near "0${"
24b8851fccSafresh1syntax error at - line 1, near "0$"
25b8851fccSafresh1Execution of - aborted due to compilation errors.
26b8851fccSafresh1########
27e0680481Safresh1# NAME (Missing operator before "$#{"?) [perl #123737]
28b8851fccSafresh10$#{
29b8851fccSafresh1EXPECT
30e0680481Safresh1Array length found where operator expected (Missing operator before "$#{"?) at - line 1, near "0$#{"
31b8851fccSafresh1syntax error at - line 1, near "0$#"
32b8851fccSafresh1Execution of - aborted due to compilation errors.
33b8851fccSafresh1########
34e0680481Safresh1# NAME (Missing operator before "@foo") [perl #123737]
35b8851fccSafresh10@foo
36b8851fccSafresh1EXPECT
37e0680481Safresh1Array found where operator expected (Missing operator before "@foo"?) at - line 1, near "0@foo"
38b8851fccSafresh1syntax error at - line 1, near "0@foo
39b8851fccSafresh1"
40b8851fccSafresh1Execution of - aborted due to compilation errors.
41b8851fccSafresh1########
42e0680481Safresh1# NAME (Missing operator before "@{") [perl #123737]
43b8851fccSafresh10@{
44b8851fccSafresh1EXPECT
45e0680481Safresh1Array found where operator expected (Missing operator before "@{"?) at - line 1, near "0@{"
46b8851fccSafresh1syntax error at - line 1, near "0@"
47b8851fccSafresh1Execution of - aborted due to compilation errors.
48b8851fccSafresh1########
4991f110e0Safresh1# NAME Unterminated here-doc in string eval
5091f110e0Safresh1eval "<<foo"; die $@
5191f110e0Safresh1EXPECT
5291f110e0Safresh1Can't find string terminator "foo" anywhere before EOF at (eval 1) line 1.
5391f110e0Safresh1########
5491f110e0Safresh1# NAME Unterminated here-doc in s/// string eval
5591f110e0Safresh1eval "s//<<foo/e"; die $@
5691f110e0Safresh1EXPECT
5791f110e0Safresh1Can't find string terminator "foo" anywhere before EOF at (eval 1) line 1.
5891f110e0Safresh1########
59b8851fccSafresh1# NAME Unterminated here-doc in string
60b8851fccSafresh1"${<<foo"; # Used to give ‘Attempt to free blah blah blah’
61b8851fccSafresh1EXPECT
62b8851fccSafresh1Can't find string terminator "foo" anywhere before EOF at - line 1.
63b8851fccSafresh1########
649f11ffb7Safresh1# NAME Unterminated here-doc with non-Latin-1 terminator
659f11ffb7Safresh1BEGIN { binmode STDERR, ":utf8" }
669f11ffb7Safresh1use utf8;
679f11ffb7Safresh1<<옷옷
689f11ffb7Safresh1EXPECT
699f11ffb7Safresh1Can't find string terminator "옷옷" anywhere before EOF at - line 3.
709f11ffb7Safresh1########
71b8851fccSafresh1# NAME Unterminated qw//
72b8851fccSafresh1qw/
73b8851fccSafresh1EXPECT
74b8851fccSafresh1Can't find string terminator "/" anywhere before EOF at - line 1.
75b8851fccSafresh1########
76b8851fccSafresh1# NAME Unterminated q//
77b8851fccSafresh1qw/
78b8851fccSafresh1EXPECT
79b8851fccSafresh1Can't find string terminator "/" anywhere before EOF at - line 1.
80b8851fccSafresh1########
81b8851fccSafresh1# NAME Unterminated ''
82b8851fccSafresh1'
83b8851fccSafresh1EXPECT
84b8851fccSafresh1Can't find string terminator "'" anywhere before EOF at - line 1.
85b8851fccSafresh1########
869f11ffb7Safresh1# NAME Unterminated ""
879f11ffb7Safresh1"
889f11ffb7Safresh1EXPECT
899f11ffb7Safresh1Can't find string terminator '"' anywhere before EOF at - line 1.
909f11ffb7Safresh1########
919f11ffb7Safresh1# NAME Unterminated q// with non-ASCII delimiter, under utf8
929f11ffb7Safresh1BEGIN { binmode STDERR, ":utf8" }
939f11ffb7Safresh1use utf8;
94eac174f2Safresh1no warnings 'deprecated';
959f11ffb7Safresh1969f11ffb7Safresh1EXPECT
97eac174f2Safresh1Can't find string terminator "«" anywhere before EOF at - line 4.
989f11ffb7Safresh1########
999f11ffb7Safresh1# NAME Unterminated q// with non-Latin-1 delimiter
1009f11ffb7Safresh1BEGIN { binmode STDERR, ":utf8" }
1019f11ffb7Safresh1use utf8;
1029f11ffb7Safresh1q 옷
1039f11ffb7Safresh1EXPECT
1049f11ffb7Safresh1Can't find string terminator "옷" anywhere before EOF at - line 3.
1059f11ffb7Safresh1########
106eac174f2Safresh1# NAME extra paired delimiters Latin1 range in UTF-8
107eac174f2Safresh1BEGIN { binmode STDERR, ":utf8" }
108eac174f2Safresh1use utf8;
109eac174f2Safresh1use feature 'extra_paired_delimiters';
110eac174f2Safresh1no warnings 'experimental::extra_paired_delimiters';
111eac174f2Safresh1my $good = q«this string has a mirrored terminator»;
112eac174f2Safresh1my $bad = q«this string needs to have a mirrored terminator«;
113eac174f2Safresh1EXPECT
114eac174f2Safresh1Can't find string terminator "»" anywhere before EOF at - line 6.
115eac174f2Safresh1########
116eac174f2Safresh1# NAME reversed extra paired delimiters Latin1 range in UTF-8
117eac174f2Safresh1BEGIN { binmode STDERR, ":utf8" }
118eac174f2Safresh1use utf8;
119eac174f2Safresh1use feature 'extra_paired_delimiters';
120eac174f2Safresh1no warnings 'experimental::extra_paired_delimiters';
121eac174f2Safresh1my $good = q»this string has a mirrored terminator«;
122eac174f2Safresh1my $bad = q»this string needs to have a mirrored terminator»;
123eac174f2Safresh1EXPECT
124eac174f2Safresh1Can't find string terminator "«" anywhere before EOF at - line 6.
125eac174f2Safresh1########
126eac174f2Safresh1# NAME paired non-ASCII Latin1 delimiters need feature enabled, in UTF-8
127eac174f2Safresh1BEGIN { binmode STDERR, ":utf8" }
128eac174f2Safresh1use utf8;
129eac174f2Safresh1my $good = q«this string works as before without the feature enabled«;
130eac174f2Safresh1no warnings 'deprecated';
131eac174f2Safresh1my $bad = q«this string has a mirrored terminator»;
132eac174f2Safresh1EXPECT
133eac174f2Safresh1Use of '«' is deprecated as a string delimiter at - line 3.
134eac174f2Safresh1Can't find string terminator "«" anywhere before EOF at - line 5.
135eac174f2Safresh1########
136*3d61058aSafresh1# NAME mirrored delimiters in R-to-L scripts are invalid
137*3d61058aSafresh1BEGIN { binmode STDERR, ":utf8" }
138*3d61058aSafresh1use utf8;
139*3d61058aSafresh1use feature 'extra_paired_delimiters';
140*3d61058aSafresh1my $good = q܈this string is delimitted by a symbol in a R-to-L script܈;
141*3d61058aSafresh1$good = q܇this string is delimitted by a symbol in a R-to-L script܇;
142*3d61058aSafresh1my $bad = q܈Can't use mirrored R-to-L script delimiters܇;
143*3d61058aSafresh1EXPECT
144*3d61058aSafresh1Can't find string terminator "܈" anywhere before EOF at - line 6.
145*3d61058aSafresh1########
146*3d61058aSafresh1# NAME mirrored delimiters in R-to-L scripts are invalid in the other order too
147*3d61058aSafresh1BEGIN { binmode STDERR, ":utf8" }
148*3d61058aSafresh1use utf8;
149*3d61058aSafresh1use feature 'extra_paired_delimiters';
150*3d61058aSafresh1my $bad = q܇Can't use mirrored R-to-L script delimiters܈;
151*3d61058aSafresh1EXPECT
152*3d61058aSafresh1Can't find string terminator "܇" anywhere before EOF at - line 4.
153*3d61058aSafresh1########
154eac174f2Safresh1# NAME paired above Latin1 delimiters need feature enabled
155eac174f2Safresh1BEGIN { binmode STDERR, ":utf8" }
156eac174f2Safresh1use utf8;
157eac174f2Safresh1my $bad = q《this string has a mirrored terminator》;
158eac174f2Safresh1EXPECT
159eac174f2Safresh1Use of '《' is deprecated as a string delimiter at - line 3.
160eac174f2Safresh1Can't find string terminator "《" anywhere before EOF at - line 3.
161eac174f2Safresh1########
1626fb12b70Safresh1# NAME /\N{/
1636fb12b70Safresh1/\N{/
1646fb12b70Safresh1EXPECT
1656fb12b70Safresh1Missing right brace on \N{} or unescaped left brace after \N at - line 1, within pattern
1666fb12b70Safresh1Execution of - aborted due to compilation errors.
1676fb12b70Safresh1########
168b8851fccSafresh1# NAME map{for our *a...
169b8851fccSafresh1map{for our *a (1..10) {$_.=$x}}
170b8851fccSafresh1EXPECT
171b8851fccSafresh1Missing $ on loop variable at - line 1.
172b8851fccSafresh1########
17391f110e0Safresh1# NAME Missing name in "my sub"
17491f110e0Safresh1use feature 'lexical_subs'; my sub;
17591f110e0Safresh1EXPECT
17691f110e0Safresh1Missing name in "my sub" at - line 1.
17791f110e0Safresh1########
17891f110e0Safresh1# NAME Missing name in "our sub"
17991f110e0Safresh1use feature 'lexical_subs'; our sub;
18091f110e0Safresh1EXPECT
18191f110e0Safresh1Missing name in "our sub" at - line 1.
18291f110e0Safresh1########
18391f110e0Safresh1# NAME Missing name in "state sub"
1849f11ffb7Safresh1use 5.01;
18591f110e0Safresh1state sub;
18691f110e0Safresh1EXPECT
18791f110e0Safresh1Missing name in "state sub" at - line 2.
18891f110e0Safresh1########
1899f11ffb7Safresh1# NAME our sub pack::foo
1909f11ffb7Safresh1our sub foo::bar;
1919f11ffb7Safresh1EXPECT
1929f11ffb7Safresh1No package name allowed for subroutine &foo::bar in "our" at - line 1, near "our sub foo::bar"
1939f11ffb7Safresh1Execution of - aborted due to compilation errors.
1949f11ffb7Safresh1########
195b8851fccSafresh1# NAME my sub pack::foo
196b8851fccSafresh1use feature 'lexical_subs', 'state';
197b8851fccSafresh1my sub foo::bar;
198b8851fccSafresh1state sub foo::bear;
199b8851fccSafresh1EXPECT
200b8851fccSafresh1"my" subroutine &foo::bar can't be in a package at - line 2, near "my sub foo::bar"
201b8851fccSafresh1"state" subroutine &foo::bear can't be in a package at - line 3, near "state sub foo::bear"
202b8851fccSafresh1Execution of - aborted due to compilation errors.
203b8851fccSafresh1########
20491f110e0Safresh1# NAME Integer constant overloading returning undef
20591f110e0Safresh1use overload;
20691f110e0Safresh1BEGIN { overload::constant integer => sub {}; undef *^H }
20791f110e0Safresh11
20891f110e0Safresh1EXPECT
20991f110e0Safresh1Constant(1) unknown at - line 3, at end of line
21091f110e0Safresh1Execution of - aborted due to compilation errors.
21191f110e0Safresh1########
21291f110e0Safresh1# NAME Float constant overloading returning undef
21391f110e0Safresh1use overload;
21491f110e0Safresh1BEGIN { overload::constant float => sub {}; undef *^H }
21591f110e0Safresh11.1
21691f110e0Safresh1EXPECT
21791f110e0Safresh1Constant(1.1) unknown at - line 3, at end of line
21891f110e0Safresh1Execution of - aborted due to compilation errors.
21991f110e0Safresh1########
22091f110e0Safresh1# NAME Binary constant overloading returning undef
22191f110e0Safresh1use overload;
22291f110e0Safresh1BEGIN { overload::constant binary => sub {}; undef *^H }
22391f110e0Safresh10x1
22491f110e0Safresh1EXPECT
22591f110e0Safresh1Constant(0x1) unknown at - line 3, at end of line
22691f110e0Safresh1Execution of - aborted due to compilation errors.
22791f110e0Safresh1########
22891f110e0Safresh1# NAME String constant overloading returning undef
22991f110e0Safresh1use overload;
23091f110e0Safresh1BEGIN { overload::constant q => sub {}; undef *^H }
23191f110e0Safresh1'1', "1$_", tr"a"", s""a"
23291f110e0Safresh1EXPECT
23391f110e0Safresh1Constant(q) unknown at - line 3, near "'1'"
23491f110e0Safresh1Constant(qq) unknown at - line 3, within string
23591f110e0Safresh1Constant(tr) unknown at - line 3, within string
23691f110e0Safresh1Constant(s) unknown at - line 3, within string
23791f110e0Safresh1Execution of - aborted due to compilation errors.
23891f110e0Safresh1########
23991f110e0Safresh1# NAME Regexp constant overloading when *^H is undefined
24091f110e0Safresh1use overload;
24191f110e0Safresh1BEGIN { overload::constant qr => sub {}; undef *^H }
2429f11ffb7Safresh1/a/
24391f110e0Safresh1EXPECT
24491f110e0Safresh1Constant(qq) unknown at - line 3, within pattern
2459f11ffb7Safresh1Execution of - aborted due to compilation errors.
2469f11ffb7Safresh1########
2479f11ffb7Safresh1# NAME Regexp constant overloading when *^H is undefined
2489f11ffb7Safresh1use overload;
2499f11ffb7Safresh1BEGIN { overload::constant qr => sub {}; undef *^H }
2509f11ffb7Safresh1m'a'
2519f11ffb7Safresh1EXPECT
25291f110e0Safresh1Constant(q) unknown at - line 3, within pattern
25391f110e0Safresh1Execution of - aborted due to compilation errors.
25491f110e0Safresh1########
25591f110e0Safresh1# NAME \N{...} when charnames fails to load but without an error
25691f110e0Safresh1# SKIP ? exists $ENV{PERL_UNICODE} ? "Unreliable under some PERL_UNICODE settings" : 0
25791f110e0Safresh1BEGIN { ++$_ for @INC{"charnames.pm","_charnames.pm"} }
25891f110e0Safresh1"\N{a}"
25991f110e0Safresh1EXPECT
26091f110e0Safresh1Constant(\N{a}) unknown at - line 2, within string
26191f110e0Safresh1Execution of - aborted due to compilation errors.
26291f110e0Safresh1########
26391f110e0Safresh1# NAME Integer constant overloading returning undef
26491f110e0Safresh1use overload;
26591f110e0Safresh1BEGIN { overload::constant integer => sub {} }
26691f110e0Safresh11
26791f110e0Safresh1EXPECT
26891f110e0Safresh1Constant(1): Call to &{$^H{integer}} did not return a defined value at - line 3, at end of line
26991f110e0Safresh1Execution of - aborted due to compilation errors.
27091f110e0Safresh1########
27191f110e0Safresh1# NAME Float constant overloading returning undef
27291f110e0Safresh1use overload;
27391f110e0Safresh1BEGIN { overload::constant float => sub {} }
27491f110e0Safresh11.1
27591f110e0Safresh1EXPECT
27691f110e0Safresh1Constant(1.1): Call to &{$^H{float}} did not return a defined value at - line 3, at end of line
27791f110e0Safresh1Execution of - aborted due to compilation errors.
27891f110e0Safresh1########
27991f110e0Safresh1# NAME Binary constant overloading returning undef
28091f110e0Safresh1use overload;
28191f110e0Safresh1BEGIN { overload::constant binary => sub {} }
28291f110e0Safresh10x1
28391f110e0Safresh1EXPECT
28491f110e0Safresh1Constant(0x1): Call to &{$^H{binary}} did not return a defined value at - line 3, at end of line
28591f110e0Safresh1Execution of - aborted due to compilation errors.
28691f110e0Safresh1########
28791f110e0Safresh1# NAME String constant overloading returning undef
28891f110e0Safresh1use overload;
28991f110e0Safresh1BEGIN { overload::constant q => sub {} }
29091f110e0Safresh1'1', "1$_", tr"a"", s""a"
29191f110e0Safresh1EXPECT
29291f110e0Safresh1Constant(q): Call to &{$^H{q}} did not return a defined value at - line 3, near "'1'"
29391f110e0Safresh1Constant(qq): Call to &{$^H{q}} did not return a defined value at - line 3, within string
29491f110e0Safresh1Constant(tr): Call to &{$^H{q}} did not return a defined value at - line 3, within string
29591f110e0Safresh1Constant(s): Call to &{$^H{q}} did not return a defined value at - line 3, within string
29691f110e0Safresh1Execution of - aborted due to compilation errors.
29791f110e0Safresh1########
29891f110e0Safresh1# NAME Regexp constant overloading returning undef
29991f110e0Safresh1use overload;
30091f110e0Safresh1BEGIN { overload::constant qr => sub {} }
3019f11ffb7Safresh1/a/
30291f110e0Safresh1EXPECT
30391f110e0Safresh1Constant(qq): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern
3049f11ffb7Safresh1Execution of - aborted due to compilation errors.
3059f11ffb7Safresh1########
3069f11ffb7Safresh1# NAME Regexp constant overloading returning undef
3079f11ffb7Safresh1use overload;
3089f11ffb7Safresh1BEGIN { overload::constant qr => sub {} }
3099f11ffb7Safresh1m'a'
3109f11ffb7Safresh1EXPECT
31191f110e0Safresh1Constant(q): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern
31291f110e0Safresh1Execution of - aborted due to compilation errors.
31391f110e0Safresh1########
314b8851fccSafresh1# NAME Failed constant overloading should not cause a double free
315b8851fccSafresh1use overload;
316b8851fccSafresh1BEGIN { overload::constant q => sub {}; undef *^H }
317b8851fccSafresh1undef(1,2);
318b8851fccSafresh1undef(1,2);
319b8851fccSafresh1undef(1,2);
320b8851fccSafresh1undef(1,2);
321b8851fccSafresh1undef(1,2);
322b8851fccSafresh1undef(1,2);
323b8851fccSafresh1undef(1,2);
324b8851fccSafresh1undef(1,2);
325b8851fccSafresh1undef(1,2);
326b8851fccSafresh1"a"
327b8851fccSafresh1EXPECT
328b8851fccSafresh1Too many arguments for undef operator at - line 3, near "2)"
329b8851fccSafresh1Too many arguments for undef operator at - line 4, near "2)"
330b8851fccSafresh1Too many arguments for undef operator at - line 5, near "2)"
331b8851fccSafresh1Too many arguments for undef operator at - line 6, near "2)"
332b8851fccSafresh1Too many arguments for undef operator at - line 7, near "2)"
333b8851fccSafresh1Too many arguments for undef operator at - line 8, near "2)"
334b8851fccSafresh1Too many arguments for undef operator at - line 9, near "2)"
335b8851fccSafresh1Too many arguments for undef operator at - line 10, near "2)"
336b8851fccSafresh1Too many arguments for undef operator at - line 11, near "2)"
337b8851fccSafresh1Constant(q) unknown at - line 12, near ""a""
338b8851fccSafresh1- has too many errors.
339b8851fccSafresh1########
3409f11ffb7Safresh1# NAME Bad name after ' (with other helpful messages)
3419f11ffb7Safresh1sub has{}
3429f11ffb7Safresh1has erdef => (
3439f11ffb7Safresh1    isa => 'Int',
3449f11ffb7Safresh1    is => 'ro,
3459f11ffb7Safresh1    default => sub { 1 }
3469f11ffb7Safresh1);
3479f11ffb7Safresh1
3489f11ffb7Safresh1has cxxc => (
3499f11ffb7Safresh1    isa => 'Int',
3509f11ffb7Safresh1    is => 'ro',
3519f11ffb7Safresh1    default => sub { 1 }
3529f11ffb7Safresh1);
3539f11ffb7Safresh1EXPECT
354e0680481Safresh1Bareword found where operator expected (Do you need to predeclare "isa"?) at - line 9, near "isa => 'Int"
3559f11ffb7Safresh1  (Might be a runaway multi-line '' string starting on line 4)
3569f11ffb7Safresh1Bad name after Int' at - line 9.
3579f11ffb7Safresh1########
3589f11ffb7Safresh1# NAME Bad name after :: (with other helpful messages)
3599f11ffb7Safresh1sub has{}
3609f11ffb7Safresh1has erdef => (
3619f11ffb7Safresh1    isa => 'Int',
3629f11ffb7Safresh1    is => "ro,
3639f11ffb7Safresh1    default => sub { 1 }
3649f11ffb7Safresh1);
3659f11ffb7Safresh1
3669f11ffb7Safresh1has cxxc => (
3679f11ffb7Safresh1    isa => "Foo::$subpackage",
3689f11ffb7Safresh1    is => 'ro',
3699f11ffb7Safresh1    default => sub { 1 }
3709f11ffb7Safresh1);
3719f11ffb7Safresh1EXPECT
372e0680481Safresh1Bareword found where operator expected (Do you need to predeclare "isa"?) at - line 9, near "isa => "Foo"
3739f11ffb7Safresh1  (Might be a runaway multi-line "" string starting on line 4)
3749f11ffb7Safresh1Bad name after Foo:: at - line 9.
3759f11ffb7Safresh1########
37691f110e0Safresh1# NAME Unterminated delimiter for here document
37791f110e0Safresh1<<"foo
37891f110e0Safresh1EXPECT
37991f110e0Safresh1Unterminated delimiter for here document at - line 1.
3806fb12b70Safresh1########
381b8851fccSafresh1# NAME my (our $x) errors
382b8851fccSafresh1my (our $x);
3836fb12b70Safresh1EXPECT
3849f11ffb7Safresh1Can't redeclare "our" in "my" at - line 1, near "(our"
385b8851fccSafresh1Execution of - aborted due to compilation errors.
3866fb12b70Safresh1########
387b8851fccSafresh1# NAME our (my $x) errors
388b8851fccSafresh1our (my $x);
3896fb12b70Safresh1EXPECT
3909f11ffb7Safresh1Can't redeclare "my" in "our" at - line 1, near "(my"
391b8851fccSafresh1Execution of - aborted due to compilation errors.
3926fb12b70Safresh1########
393b8851fccSafresh1# NAME state (my $x) errors
394b8851fccSafresh1use feature 'state';
395b8851fccSafresh1state (my $x);
3966fb12b70Safresh1EXPECT
3979f11ffb7Safresh1Can't redeclare "my" in "state" at - line 2, near "(my"
398b8851fccSafresh1Execution of - aborted due to compilation errors.
399b8851fccSafresh1########
400b8851fccSafresh1# NAME our (state $x) errors
401b8851fccSafresh1use feature 'state';
402b8851fccSafresh1our (state $x);
403b8851fccSafresh1EXPECT
4049f11ffb7Safresh1Can't redeclare "state" in "our" at - line 2, near "(state"
405b8851fccSafresh1Execution of - aborted due to compilation errors.
406b8851fccSafresh1########
407b8851fccSafresh1# NAME my (my $x) errors
408b8851fccSafresh1my (my $x, $y, $z);
409b8851fccSafresh1EXPECT
4109f11ffb7Safresh1Can't redeclare "my" in "my" at - line 1, near "(my"
411b8851fccSafresh1Execution of - aborted due to compilation errors.
412b8851fccSafresh1########
413b8851fccSafresh1# NAME our (our $x) errors
414b8851fccSafresh1our ($x, our($y), $z);
415b8851fccSafresh1EXPECT
4169f11ffb7Safresh1Can't redeclare "our" in "our" at - line 1, near ", our"
417b8851fccSafresh1Execution of - aborted due to compilation errors.
418b8851fccSafresh1########
419b8851fccSafresh1# NAME state (state $x) errors
420b8851fccSafresh1use feature 'state';
421b8851fccSafresh1state ($x, $y, state $z);
422b8851fccSafresh1EXPECT
4239f11ffb7Safresh1Can't redeclare "state" in "state" at - line 2, near ", state"
424b8851fccSafresh1Execution of - aborted due to compilation errors.
425b8851fccSafresh1########
426b8851fccSafresh1# NAME BEGIN <> [perl #125341]
427b8851fccSafresh1BEGIN <>
428b8851fccSafresh1EXPECT
429b8851fccSafresh1Illegal declaration of subroutine BEGIN at - line 1.
4309f11ffb7Safresh1########
4312266fceeSafresh1# NAME multiple conflict markers.
4322266fceeSafresh1# NOTE the <CONFLICT< style text is auto-replaced in test.pl run_multiple_progs
4332266fceeSafresh1<CONFLICT< yours:sample.txt
4349f11ffb7Safresh1my $some_code;
4352266fceeSafresh1=CONFLICT=
4369f11ffb7Safresh1my $some_other_code;
4372266fceeSafresh1>CONFLICT> theirs:sample.txt
4389f11ffb7Safresh1EXPECT
4392266fceeSafresh1Version control conflict marker at - line 1, near "<CONFLICT<"
4402266fceeSafresh1Version control conflict marker at - line 3, near "=CONFLICT="
4412266fceeSafresh1Version control conflict marker at - line 5, near ">CONFLICT>"
4429f11ffb7Safresh1Execution of - aborted due to compilation errors.
4439f11ffb7Safresh1########
4449f11ffb7Safresh1# NAME (Might be a runaway multi-line...) with Latin-1 delimiters in utf8
4459f11ffb7Safresh1BEGIN { binmode STDERR, ':utf8' }
4469f11ffb7Safresh1use utf8;
447eac174f2Safresh1no warnings 'deprecated';
4489f11ffb7Safresh14499f11ffb7Safresh1« time
4509f11ffb7Safresh1EXPECT
451eac174f2Safresh1syntax error at - line 5, near "« time"
452eac174f2Safresh1  (Might be a runaway multi-line «« string starting on line 4)
4539f11ffb7Safresh1Execution of - aborted due to compilation errors.
4549f11ffb7Safresh1########
4559f11ffb7Safresh1# NAME (Might be a runaway multi-line...) with non-Latin-1 delimiters
4569f11ffb7Safresh1BEGIN { binmode STDERR, ':utf8' }
4579f11ffb7Safresh1use utf8;
4589f11ffb7Safresh1q ϡ
4599f11ffb7Safresh1ϡ time
4609f11ffb7Safresh1EXPECT
4619f11ffb7Safresh1syntax error at - line 4, near "ϡ time"
4629f11ffb7Safresh1  (Might be a runaway multi-line ϡϡ string starting on line 3)
4639f11ffb7Safresh1Execution of - aborted due to compilation errors.
4649f11ffb7Safresh1########
4659f11ffb7Safresh1# NAME tr/// handling of mis-formatted \o characters
4669f11ffb7Safresh1# may only fail with ASAN
4679f11ffb7Safresh1tr/\o-0//;
4689f11ffb7Safresh1EXPECT
4699f11ffb7Safresh1Missing braces on \o{} at - line 2, within string
4709f11ffb7Safresh1Execution of - aborted due to compilation errors.
4719f11ffb7Safresh1########
4729f11ffb7Safresh1# NAME bare <<
4739f11ffb7Safresh1$a = <<;
4749f11ffb7Safresh1
4759f11ffb7Safresh1EXPECT
4769f11ffb7Safresh1Use of bare << to mean <<"" is forbidden at - line 1.
4779f11ffb7Safresh1########
4789f11ffb7Safresh1# NAME bare <<~
4799f11ffb7Safresh1$a = <<~;
4809f11ffb7Safresh1EXPECT
4819f11ffb7Safresh1Use of bare << to mean <<"" is forbidden at - line 1.
4829f11ffb7Safresh1########
4839f11ffb7Safresh1# NAME bare <<~
4849f11ffb7Safresh1$a = <<~ ;
4859f11ffb7Safresh1
4869f11ffb7Safresh1EXPECT
4879f11ffb7Safresh1Use of bare << to mean <<"" is forbidden at - line 1.
4889f11ffb7Safresh1########
4899f11ffb7Safresh1# NAME incomplete floating point decimal exponent (#131725)
4909f11ffb7Safresh11e--5
4919f11ffb7Safresh1EXPECT
492e0680481Safresh1Bareword found where operator expected (Missing operator before "e"?) at - line 1, near "1e"
4939f11ffb7Safresh1syntax error at - line 1, near "1e"
4949f11ffb7Safresh1Execution of - aborted due to compilation errors.
4959f11ffb7Safresh1########
4969f11ffb7Safresh1# NAME signature with non-"=" assignop #131777
4979f11ffb7Safresh1use feature 'signatures';
4989f11ffb7Safresh1sub foo ($a += 1)
4999f11ffb7Safresh1EXPECT
500eac174f2Safresh1Illegal operator following parameter in a subroutine signature at - line 2, near "($a += 1"
501eac174f2Safresh1syntax error at - line 2, near "($a += 1"
5029f11ffb7Safresh1Execution of - aborted due to compilation errors.
5039f11ffb7Safresh1########
5049f11ffb7Safresh1# NAME tr/// range with empty \N{} at the start
5059f11ffb7Safresh1tr//\N{}-0/;
5069f11ffb7Safresh1EXPECT
5079f11ffb7Safresh1Unknown charname '' at - line 1, within string
5089f11ffb7Safresh1Execution of - aborted due to compilation errors.
5099f11ffb7Safresh1########
5109f11ffb7Safresh1# NAME octal fp with non-octal digits after the decimal point
5119f11ffb7Safresh101.1234567p0;
5129f11ffb7Safresh107.8p0;
5139f11ffb7Safresh1EXPECT
514e0680481Safresh1Bareword found where operator expected (Missing operator before "p0"?) at - line 2, near "8p0"
5159f11ffb7Safresh1syntax error at - line 2, near "8p0"
5169f11ffb7Safresh1Execution of - aborted due to compilation errors.
5179f11ffb7Safresh1########
5189f11ffb7Safresh1# NAME binary fp with non-binary digits after the decimal point
5199f11ffb7Safresh10b1.10p0;
5209f11ffb7Safresh10b1.2p0;
5219f11ffb7Safresh1EXPECT
522e0680481Safresh1Bareword found where operator expected (Missing operator before "p0"?) at - line 2, near "2p0"
5239f11ffb7Safresh1syntax error at - line 2, near "2p0"
5249f11ffb7Safresh1Execution of - aborted due to compilation errors.
525e603c72fSafresh1########
526b46d8ef2Safresh1# NAME dump() must be written as CORE::dump() as of Perl 5.30
527b46d8ef2Safresh1BEGIN { $^C = 1; }
528b46d8ef2Safresh1dump;
529b46d8ef2Safresh1CORE::dump;
530b46d8ef2Safresh1EXPECT
531b46d8ef2Safresh1dump() must be written as CORE::dump() as of Perl 5.30 at - line 2.
532b46d8ef2Safresh1########
533b46d8ef2Safresh1# NAME check Prototype not terminated includes line number (133524)
534b46d8ef2Safresh1sub t1 {}
535b46d8ef2Safresh1sub t2 (}
536b46d8ef2Safresh1EXPECT
537b46d8ef2Safresh1Prototype not terminated at - line 2.
538b46d8ef2Safresh1########
539e603c72fSafresh1# NAME [perl #132158] format with syntax errors
540e603c72fSafresh1format=
541e603c72fSafresh1@
542e603c72fSafresh1=h
543e603c72fSafresh1=cut
544e603c72fSafresh1EXPECT
545e603c72fSafresh1syntax error at - line 4, next token ???
546e603c72fSafresh1Execution of - aborted due to compilation errors.
54756d68f1eSafresh1########
548eac174f2Safresh1# NAME [perl #134125] [gh #17010] incomplete hex number
54956d68f1eSafresh10x x 2;
55056d68f1eSafresh10xx 2;
55156d68f1eSafresh10x_;
55256d68f1eSafresh10b;
55356d68f1eSafresh1EXPECT
55456d68f1eSafresh1No digits found for hexadecimal literal at - line 1, near "0x "
55556d68f1eSafresh1No digits found for hexadecimal literal at - line 2, near "0xx"
55656d68f1eSafresh1No digits found for hexadecimal literal at - line 3, near "0x_;"
55756d68f1eSafresh1No digits found for binary literal at - line 4, near "0b;"
55856d68f1eSafresh1Execution of - aborted due to compilation errors.
55956d68f1eSafresh1########
56056d68f1eSafresh1# NAME [perl #130585] close paren in subparse
56156d68f1eSafresh1qr!@{s{0})(?{!;
56256d68f1eSafresh1EXPECT
56356d68f1eSafresh1syntax error at - line 1, near "})"
56456d68f1eSafresh1Execution of - aborted due to compilation errors.
56556d68f1eSafresh1########
56656d68f1eSafresh1# NAME [perl #130585] close paren in subparse - a few more tests
56756d68f1eSafresh1my ($x, %y, @z);
56856d68f1eSafresh1qq!$x\U $z[0] $y{a}\E $z[1]!;
56956d68f1eSafresh1qq!$x\U@{s{0})(?{!;
57056d68f1eSafresh1EXPECT
57156d68f1eSafresh1syntax error at - line 3, near ")("
57256d68f1eSafresh1Execution of - aborted due to compilation errors.
57356d68f1eSafresh1########
57456d68f1eSafresh1# NAME [perl #134310] don't confuse S_no_op() with PL_bufptr after s
57556d68f1eSafresh10 0x@
57656d68f1eSafresh1EXPECT
577e0680481Safresh1Number found where operator expected (Missing operator before "0x"?) at - line 1, near "0 0x"
57856d68f1eSafresh1No digits found for hexadecimal literal at - line 1, near "0 0x@"
57956d68f1eSafresh1syntax error at - line 1, near "0 0x"
58056d68f1eSafresh1Execution of - aborted due to compilation errors.
58156d68f1eSafresh1########
58256d68f1eSafresh1# NAME Forbid illegal \x{} code points
58356d68f1eSafresh1use Config;
58456d68f1eSafresh1if ($Config{uvsize} < 8) {
58556d68f1eSafresh1    my $a = "\x{8000_0000}";
58656d68f1eSafresh1}
58756d68f1eSafresh1else {
58856d68f1eSafresh1    my $a = "\x{8000_0000_0000_0000}";
58956d68f1eSafresh1}
59056d68f1eSafresh1EXPECT
59156d68f1eSafresh1OPTIONS regex
59256d68f1eSafresh1Use of code point 0x80000000(00000000)? is not allowed; the permissible max is 0x7FFFFFFF(FFFFFFFF)? at - line \d+.
59356d68f1eSafresh1########
59456d68f1eSafresh1# NAME Forbid illegal \o{} code points
59556d68f1eSafresh1use Config;
59656d68f1eSafresh1if ($Config{uvsize} < 8) {
59756d68f1eSafresh1    my $b = "\o{20_000_000_000}";
59856d68f1eSafresh1}
59956d68f1eSafresh1else {
60056d68f1eSafresh1    my $b = "\o{1_000_000_000_000_000_000_000}";
60156d68f1eSafresh1}
60256d68f1eSafresh1EXPECT
60356d68f1eSafresh1OPTIONS regex
60456d68f1eSafresh1Use of code point 0x80000000(00000000)? is not allowed; the permissible max is 0x7FFFFFFF(FFFFFFFF)? at - line \d+.
60556d68f1eSafresh1########
60656d68f1eSafresh1# NAME gh-17645: conflict marker detection should not read out of bounds
60756d68f1eSafresh1m/$0[
60856d68f1eSafresh1==0/
60956d68f1eSafresh1EXPECT
61056d68f1eSafresh1syntax error at - line 2, near "[
61156d68f1eSafresh1=="
61256d68f1eSafresh1  (Might be a runaway multi-line // string starting on line 1)
61356d68f1eSafresh1Execution of - aborted due to compilation errors.
614