This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta for 0072721ceb71, beb08a1e6d63, 5c1db5695506, 2f9365dc3b09
[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########
5af08aed
FC
40# NAME Unterminated here-doc in string eval
41eval "<<foo"; die $@
42EXPECT
43Can't find string terminator "foo" anywhere before EOF at (eval 1) line 1.
44########
45# NAME Unterminated here-doc in s/// string eval
46eval "s//<<foo/e"; die $@
47EXPECT
48Can't find string terminator "foo" anywhere before EOF at (eval 1) line 1.
49########
fd2709db
FC
50# NAME Unterminated here-doc in string
51"${<<foo"; # Used to give ‘Attempt to free blah blah blah’
52EXPECT
53Can't find string terminator "foo" anywhere before EOF at - line 1.
54########
20ed5f00
FC
55# NAME Unterminated qw//
56qw/
57EXPECT
58Can't find string terminator "/" anywhere before EOF at - line 1.
59########
60# NAME Unterminated q//
61qw/
62EXPECT
63Can't find string terminator "/" anywhere before EOF at - line 1.
64########
65# NAME Unterminated ''
66'
67EXPECT
68Can't find string terminator "'" anywhere before EOF at - line 1.
69########
4407f1b8
FC
70# NAME /\N{/
71/\N{/
72EXPECT
73Missing right brace on \N{} or unescaped left brace after \N at - line 1, within pattern
ca53e5d5 74Execution of - aborted due to compilation errors.
4407f1b8 75########
e660c409
FC
76# NAME map{for our *a...
77map{for our *a (1..10) {$_.=$x}}
78EXPECT
79Missing $ on loop variable at - line 1.
80########
ca8ffed2 81# NAME Missing name in "my sub"
e7d0b801 82use feature 'lexical_subs'; my sub;
ca8ffed2 83EXPECT
e7d0b801 84The lexical_subs feature is experimental at - line 1.
ca8ffed2 85Missing name in "my sub" at - line 1.
6f2d7fc9 86########
8767b1ab 87# NAME Missing name in "our sub"
e7d0b801 88use feature 'lexical_subs'; our sub;
8767b1ab 89EXPECT
e7d0b801 90The lexical_subs feature is experimental at - line 1.
8767b1ab
FC
91Missing name in "our sub" at - line 1.
92########
93# NAME Missing name in "state sub"
e7d0b801 94use 5.01; use feature 'lexical_subs';
8767b1ab
FC
95state sub;
96EXPECT
64fbf0dd 97The lexical_subs feature is experimental at - line 2.
8767b1ab
FC
98Missing name in "state sub" at - line 2.
99########
a21eb52b
FC
100# NAME my sub pack::foo
101use feature 'lexical_subs', 'state';
102my sub foo::bar;
103state sub foo::bear;
104EXPECT
105The lexical_subs feature is experimental at - line 2.
106The lexical_subs feature is experimental at - line 3.
107"my" subroutine &foo::bar can't be in a package at - line 2, near "my sub foo::bar"
108"state" subroutine &foo::bear can't be in a package at - line 3, near "state sub foo::bear"
109Execution of - aborted due to compilation errors.
110########
b2e3d01a
FC
111# NAME Integer constant overloading returning undef
112use overload;
247a7f40
FC
113BEGIN { overload::constant integer => sub {}; undef *^H }
1141
115EXPECT
bb4784f0 116Constant(1) unknown at - line 3, at end of line
247a7f40
FC
117Execution of - aborted due to compilation errors.
118########
119# NAME Float constant overloading returning undef
120use overload;
121BEGIN { overload::constant float => sub {}; undef *^H }
1221.1
123EXPECT
bb4784f0 124Constant(1.1) unknown at - line 3, at end of line
247a7f40
FC
125Execution of - aborted due to compilation errors.
126########
127# NAME Binary constant overloading returning undef
128use overload;
129BEGIN { overload::constant binary => sub {}; undef *^H }
1300x1
131EXPECT
bb4784f0 132Constant(0x1) unknown at - line 3, at end of line
247a7f40
FC
133Execution of - aborted due to compilation errors.
134########
135# NAME String constant overloading returning undef
136use overload;
137BEGIN { overload::constant q => sub {}; undef *^H }
138'1', "1$_", tr"a"", s""a"
139EXPECT
140Constant(q) unknown at - line 3, near "'1'"
141Constant(qq) unknown at - line 3, within string
142Constant(tr) unknown at - line 3, within string
143Constant(s) unknown at - line 3, within string
144Execution of - aborted due to compilation errors.
145########
146# NAME Regexp constant overloading when *^H is undefined
147use overload;
148BEGIN { overload::constant qr => sub {}; undef *^H }
149/a/, m'a'
150EXPECT
151Constant(qq) unknown at - line 3, within pattern
152Constant(q) unknown at - line 3, within pattern
153Execution of - aborted due to compilation errors.
154########
155# NAME \N{...} when charnames fails to load but without an error
d4ead2eb 156# SKIP ? exists $ENV{PERL_UNICODE} ? "Unreliable under some PERL_UNICODE settings" : 0
247a7f40
FC
157BEGIN { ++$_ for @INC{"charnames.pm","_charnames.pm"} }
158"\N{a}"
159EXPECT
160Constant(\N{a}) unknown at - line 2, within string
161Execution of - aborted due to compilation errors.
162########
163# NAME Integer constant overloading returning undef
164use overload;
b2e3d01a
FC
165BEGIN { overload::constant integer => sub {} }
1661
167EXPECT
bb4784f0 168Constant(1): Call to &{$^H{integer}} did not return a defined value at - line 3, at end of line
b2e3d01a
FC
169Execution of - aborted due to compilation errors.
170########
171# NAME Float constant overloading returning undef
172use overload;
173BEGIN { overload::constant float => sub {} }
1741.1
175EXPECT
bb4784f0 176Constant(1.1): Call to &{$^H{float}} did not return a defined value at - line 3, at end of line
b2e3d01a
FC
177Execution of - aborted due to compilation errors.
178########
179# NAME Binary constant overloading returning undef
180use overload;
181BEGIN { overload::constant binary => sub {} }
1820x1
183EXPECT
bb4784f0 184Constant(0x1): Call to &{$^H{binary}} did not return a defined value at - line 3, at end of line
b2e3d01a
FC
185Execution of - aborted due to compilation errors.
186########
187# NAME String constant overloading returning undef
188use overload;
189BEGIN { overload::constant q => sub {} }
190'1', "1$_", tr"a"", s""a"
191EXPECT
192Constant(q): Call to &{$^H{q}} did not return a defined value at - line 3, near "'1'"
193Constant(qq): Call to &{$^H{q}} did not return a defined value at - line 3, within string
194Constant(tr): Call to &{$^H{q}} did not return a defined value at - line 3, within string
195Constant(s): Call to &{$^H{q}} did not return a defined value at - line 3, within string
196Execution of - aborted due to compilation errors.
197########
198# NAME Regexp constant overloading returning undef
199use overload;
200BEGIN { overload::constant qr => sub {} }
201/a/, m'a'
202EXPECT
203Constant(qq): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern
204Constant(q): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern
205Execution of - aborted due to compilation errors.
206########
67c71cbb
FC
207# NAME Failed constant overloading should not cause a double free
208use overload;
209BEGIN { overload::constant q => sub {}; undef *^H }
210undef(1,2);
211undef(1,2);
212undef(1,2);
213undef(1,2);
214undef(1,2);
215undef(1,2);
216undef(1,2);
217undef(1,2);
218undef(1,2);
219"a"
220EXPECT
221Too many arguments for undef operator at - line 3, near "2)"
222Too many arguments for undef operator at - line 4, near "2)"
223Too many arguments for undef operator at - line 5, near "2)"
224Too many arguments for undef operator at - line 6, near "2)"
225Too many arguments for undef operator at - line 7, near "2)"
226Too many arguments for undef operator at - line 8, near "2)"
227Too many arguments for undef operator at - line 9, near "2)"
228Too many arguments for undef operator at - line 10, near "2)"
229Too many arguments for undef operator at - line 11, near "2)"
230Constant(q) unknown at - line 12, near ""a""
231- has too many errors.
232########
6f2d7fc9
FC
233# NAME Unterminated delimiter for here document
234<<"foo
235EXPECT
236Unterminated delimiter for here document at - line 1.
f3106bc8
LM
237########
238# NAME my (our $x) errors
239my (our $x);
240EXPECT
241Can't redeclare "our" in "my" at - line 1, at end of line
242Execution of - aborted due to compilation errors.
243########
244# NAME our (my $x) errors
245our (my $x);
246EXPECT
247Can't redeclare "my" in "our" at - line 1, at end of line
248Execution of - aborted due to compilation errors.
249########
250# NAME state (my $x) errors
251use feature 'state';
252state (my $x);
253EXPECT
254Can't redeclare "my" in "state" at - line 2, at end of line
255Execution of - aborted due to compilation errors.
256########
257# NAME our (state $x) errors
258use feature 'state';
259our (state $x);
260EXPECT
261Can't redeclare "state" in "our" at - line 2, at end of line
262Execution of - aborted due to compilation errors.
263########
264# NAME my (my $x) errors
265my (my $x, $y, $z);
266EXPECT
267Can't redeclare "my" in "my" at - line 1, at end of line
268Execution of - aborted due to compilation errors.
269########
270# NAME our (our $x) errors
271our ($x, our($y), $z);
272EXPECT
273Can't redeclare "our" in "our" at - line 1, near ", "
274Execution of - aborted due to compilation errors.
275########
276# NAME state (state $x) errors
277use feature 'state';
278state ($x, $y, state $z);
279EXPECT
280Can't redeclare "state" in "state" at - line 2, near ", "
281Execution of - aborted due to compilation errors.
e6b2cf83
TC
282########
283# NAME BEGIN <> [perl #125341]
284BEGIN <>
285EXPECT
286Illegal declaration of subroutine BEGIN at - line 1.