This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
spelling: s/delimeter/delimiter/
[perl5.git] / t / lib / croak / toke
CommitLineData
ca8ffed2 1__END__
b255a112
FC
2# NAME foo found where operator expected
3myfunc 1,2,3
4EXPECT
5Number found where operator expected at - line 1, near "myfunc 1"
6 (Do you need to predeclare myfunc?)
7syntax error at - line 1, near "myfunc 1"
8Execution of - aborted due to compilation errors.
9########
10# NAME foo found where operator expected (after strict error, w/fatal warnings)
11use warnings FATAL => 'all';
12use strict;
13$foo;
14myfunc 1,2,3
15EXPECT
16Global symbol "$foo" requires explicit package name (did you forget to declare "my $foo"?) at - line 3.
17Number found where operator expected at - line 4, near "myfunc 1"
18 (Do you need to predeclare myfunc?)
19syntax error at - line 4, near "myfunc 1"
20Execution of - aborted due to compilation errors.
21########
488bc579
FC
22# NAME (Missing operator before ${?) [perl #123737]
230${
24EXPECT
25Scalar found where operator expected at - line 1, near "0${"
26 (Missing operator before ${?)
27syntax error at - line 1, near "0$"
28Missing right curly or square bracket at - line 1, at end of line
29Execution of - aborted due to compilation errors.
30########
310a0d0a
DM
31# NAME (Missing operator before $#{?) [perl #123737]
320$#{
33EXPECT
34Array length found where operator expected at - line 1, near "0$#{"
35 (Missing operator before $#{?)
36syntax error at - line 1, near "0$#"
37Missing right curly or square bracket at - line 1, at end of line
38Execution of - aborted due to compilation errors.
39########
61d30259 40# NAME (Missing operator before @foo) [perl #123737]
a7162bf7
TC
410@foo
42EXPECT
43Array found where operator expected at - line 1, near "0@foo"
44 (Missing operator before @foo?)
45syntax error at - line 1, near "0@foo
46"
47Execution of - aborted due to compilation errors.
48########
61d30259
TC
49# NAME (Missing operator before @{) [perl #123737]
500@{
51EXPECT
52Array found where operator expected at - line 1, near "0@{"
53 (Missing operator before @{?)
54syntax error at - line 1, near "0@"
55Missing right curly or square bracket at - line 1, at end of line
56Execution of - aborted due to compilation errors.
57########
5af08aed
FC
58# NAME Unterminated here-doc in string eval
59eval "<<foo"; die $@
60EXPECT
61Can't find string terminator "foo" anywhere before EOF at (eval 1) line 1.
62########
63# NAME Unterminated here-doc in s/// string eval
64eval "s//<<foo/e"; die $@
65EXPECT
66Can't find string terminator "foo" anywhere before EOF at (eval 1) line 1.
67########
fd2709db
FC
68# NAME Unterminated here-doc in string
69"${<<foo"; # Used to give ‘Attempt to free blah blah blah’
70EXPECT
71Can't find string terminator "foo" anywhere before EOF at - line 1.
72########
20ed5f00
FC
73# NAME Unterminated qw//
74qw/
75EXPECT
76Can't find string terminator "/" anywhere before EOF at - line 1.
77########
78# NAME Unterminated q//
79qw/
80EXPECT
81Can't find string terminator "/" anywhere before EOF at - line 1.
82########
83# NAME Unterminated ''
84'
85EXPECT
86Can't find string terminator "'" anywhere before EOF at - line 1.
87########
4407f1b8
FC
88# NAME /\N{/
89/\N{/
90EXPECT
91Missing right brace on \N{} or unescaped left brace after \N at - line 1, within pattern
ca53e5d5 92Execution of - aborted due to compilation errors.
4407f1b8 93########
e660c409
FC
94# NAME map{for our *a...
95map{for our *a (1..10) {$_.=$x}}
96EXPECT
97Missing $ on loop variable at - line 1.
98########
ca8ffed2 99# NAME Missing name in "my sub"
e7d0b801 100use feature 'lexical_subs'; my sub;
ca8ffed2
FC
101EXPECT
102Missing name in "my sub" at - line 1.
6f2d7fc9 103########
8767b1ab 104# NAME Missing name in "our sub"
e7d0b801 105use feature 'lexical_subs'; our sub;
8767b1ab
FC
106EXPECT
107Missing name in "our sub" at - line 1.
108########
109# NAME Missing name in "state sub"
60e04ba1 110use 5.01;
8767b1ab
FC
111state sub;
112EXPECT
113Missing name in "state sub" at - line 2.
114########
a21eb52b
FC
115# NAME my sub pack::foo
116use feature 'lexical_subs', 'state';
117my sub foo::bar;
118state sub foo::bear;
119EXPECT
a21eb52b
FC
120"my" subroutine &foo::bar can't be in a package at - line 2, near "my sub foo::bar"
121"state" subroutine &foo::bear can't be in a package at - line 3, near "state sub foo::bear"
122Execution of - aborted due to compilation errors.
123########
b2e3d01a
FC
124# NAME Integer constant overloading returning undef
125use overload;
247a7f40
FC
126BEGIN { overload::constant integer => sub {}; undef *^H }
1271
128EXPECT
bb4784f0 129Constant(1) unknown at - line 3, at end of line
247a7f40
FC
130Execution of - aborted due to compilation errors.
131########
132# NAME Float constant overloading returning undef
133use overload;
134BEGIN { overload::constant float => sub {}; undef *^H }
1351.1
136EXPECT
bb4784f0 137Constant(1.1) unknown at - line 3, at end of line
247a7f40
FC
138Execution of - aborted due to compilation errors.
139########
140# NAME Binary constant overloading returning undef
141use overload;
142BEGIN { overload::constant binary => sub {}; undef *^H }
1430x1
144EXPECT
bb4784f0 145Constant(0x1) unknown at - line 3, at end of line
247a7f40
FC
146Execution of - aborted due to compilation errors.
147########
148# NAME String constant overloading returning undef
149use overload;
150BEGIN { overload::constant q => sub {}; undef *^H }
151'1', "1$_", tr"a"", s""a"
152EXPECT
153Constant(q) unknown at - line 3, near "'1'"
154Constant(qq) unknown at - line 3, within string
155Constant(tr) unknown at - line 3, within string
156Constant(s) unknown at - line 3, within string
157Execution of - aborted due to compilation errors.
158########
159# NAME Regexp constant overloading when *^H is undefined
160use overload;
161BEGIN { overload::constant qr => sub {}; undef *^H }
162/a/, m'a'
163EXPECT
164Constant(qq) unknown at - line 3, within pattern
165Constant(q) unknown at - line 3, within pattern
166Execution of - aborted due to compilation errors.
167########
168# NAME \N{...} when charnames fails to load but without an error
d4ead2eb 169# SKIP ? exists $ENV{PERL_UNICODE} ? "Unreliable under some PERL_UNICODE settings" : 0
247a7f40
FC
170BEGIN { ++$_ for @INC{"charnames.pm","_charnames.pm"} }
171"\N{a}"
172EXPECT
173Constant(\N{a}) unknown at - line 2, within string
174Execution of - aborted due to compilation errors.
175########
176# NAME Integer constant overloading returning undef
177use overload;
b2e3d01a
FC
178BEGIN { overload::constant integer => sub {} }
1791
180EXPECT
bb4784f0 181Constant(1): Call to &{$^H{integer}} did not return a defined value at - line 3, at end of line
b2e3d01a
FC
182Execution of - aborted due to compilation errors.
183########
184# NAME Float constant overloading returning undef
185use overload;
186BEGIN { overload::constant float => sub {} }
1871.1
188EXPECT
bb4784f0 189Constant(1.1): Call to &{$^H{float}} did not return a defined value at - line 3, at end of line
b2e3d01a
FC
190Execution of - aborted due to compilation errors.
191########
192# NAME Binary constant overloading returning undef
193use overload;
194BEGIN { overload::constant binary => sub {} }
1950x1
196EXPECT
bb4784f0 197Constant(0x1): Call to &{$^H{binary}} did not return a defined value at - line 3, at end of line
b2e3d01a
FC
198Execution of - aborted due to compilation errors.
199########
200# NAME String constant overloading returning undef
201use overload;
202BEGIN { overload::constant q => sub {} }
203'1', "1$_", tr"a"", s""a"
204EXPECT
205Constant(q): Call to &{$^H{q}} did not return a defined value at - line 3, near "'1'"
206Constant(qq): Call to &{$^H{q}} did not return a defined value at - line 3, within string
207Constant(tr): Call to &{$^H{q}} did not return a defined value at - line 3, within string
208Constant(s): Call to &{$^H{q}} did not return a defined value at - line 3, within string
209Execution of - aborted due to compilation errors.
210########
211# NAME Regexp constant overloading returning undef
212use overload;
213BEGIN { overload::constant qr => sub {} }
214/a/, m'a'
215EXPECT
216Constant(qq): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern
217Constant(q): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern
218Execution of - aborted due to compilation errors.
219########
67c71cbb
FC
220# NAME Failed constant overloading should not cause a double free
221use overload;
222BEGIN { overload::constant q => sub {}; undef *^H }
223undef(1,2);
224undef(1,2);
225undef(1,2);
226undef(1,2);
227undef(1,2);
228undef(1,2);
229undef(1,2);
230undef(1,2);
231undef(1,2);
232"a"
233EXPECT
234Too many arguments for undef operator at - line 3, near "2)"
235Too many arguments for undef operator at - line 4, near "2)"
236Too many arguments for undef operator at - line 5, near "2)"
237Too many arguments for undef operator at - line 6, near "2)"
238Too many arguments for undef operator at - line 7, near "2)"
239Too many arguments for undef operator at - line 8, near "2)"
240Too many arguments for undef operator at - line 9, near "2)"
241Too many arguments for undef operator at - line 10, near "2)"
242Too many arguments for undef operator at - line 11, near "2)"
243Constant(q) unknown at - line 12, near ""a""
244- has too many errors.
245########
6f2d7fc9
FC
246# NAME Unterminated delimiter for here document
247<<"foo
248EXPECT
249Unterminated delimiter for here document at - line 1.
f3106bc8
LM
250########
251# NAME my (our $x) errors
252my (our $x);
253EXPECT
254Can't redeclare "our" in "my" at - line 1, at end of line
255Execution of - aborted due to compilation errors.
256########
257# NAME our (my $x) errors
258our (my $x);
259EXPECT
260Can't redeclare "my" in "our" at - line 1, at end of line
261Execution of - aborted due to compilation errors.
262########
263# NAME state (my $x) errors
264use feature 'state';
265state (my $x);
266EXPECT
267Can't redeclare "my" in "state" at - line 2, at end of line
268Execution of - aborted due to compilation errors.
269########
270# NAME our (state $x) errors
271use feature 'state';
272our (state $x);
273EXPECT
274Can't redeclare "state" in "our" at - line 2, at end of line
275Execution of - aborted due to compilation errors.
276########
277# NAME my (my $x) errors
278my (my $x, $y, $z);
279EXPECT
280Can't redeclare "my" in "my" at - line 1, at end of line
281Execution of - aborted due to compilation errors.
282########
283# NAME our (our $x) errors
284our ($x, our($y), $z);
285EXPECT
286Can't redeclare "our" in "our" at - line 1, near ", "
287Execution of - aborted due to compilation errors.
288########
289# NAME state (state $x) errors
290use feature 'state';
291state ($x, $y, state $z);
292EXPECT
293Can't redeclare "state" in "state" at - line 2, near ", "
294Execution of - aborted due to compilation errors.
e6b2cf83
TC
295########
296# NAME BEGIN <> [perl #125341]
297BEGIN <>
298EXPECT
299Illegal declaration of subroutine BEGIN at - line 1.