This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlvar: revise $] and $^V with less bias
[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########
5af08aed
FC
22# NAME Unterminated here-doc in string eval
23eval "<<foo"; die $@
24EXPECT
25Can't find string terminator "foo" anywhere before EOF at (eval 1) line 1.
26########
27# NAME Unterminated here-doc in s/// string eval
28eval "s//<<foo/e"; die $@
29EXPECT
30Can't find string terminator "foo" anywhere before EOF at (eval 1) line 1.
31########
fd2709db
FC
32# NAME Unterminated here-doc in string
33"${<<foo"; # Used to give ‘Attempt to free blah blah blah’
34EXPECT
35Can't find string terminator "foo" anywhere before EOF at - line 1.
36########
20ed5f00
FC
37# NAME Unterminated qw//
38qw/
39EXPECT
40Can't find string terminator "/" anywhere before EOF at - line 1.
41########
42# NAME Unterminated q//
43qw/
44EXPECT
45Can't find string terminator "/" anywhere before EOF at - line 1.
46########
47# NAME Unterminated ''
48'
49EXPECT
50Can't find string terminator "'" anywhere before EOF at - line 1.
51########
4407f1b8
FC
52# NAME /\N{/
53/\N{/
54EXPECT
55Missing right brace on \N{} or unescaped left brace after \N at - line 1, within pattern
ca53e5d5 56Execution of - aborted due to compilation errors.
4407f1b8 57########
e660c409
FC
58# NAME map{for our *a...
59map{for our *a (1..10) {$_.=$x}}
60EXPECT
61Missing $ on loop variable at - line 1.
62########
ca8ffed2 63# NAME Missing name in "my sub"
e7d0b801 64use feature 'lexical_subs'; my sub;
ca8ffed2 65EXPECT
e7d0b801 66The lexical_subs feature is experimental at - line 1.
ca8ffed2 67Missing name in "my sub" at - line 1.
6f2d7fc9 68########
8767b1ab 69# NAME Missing name in "our sub"
e7d0b801 70use feature 'lexical_subs'; our sub;
8767b1ab 71EXPECT
e7d0b801 72The lexical_subs feature is experimental at - line 1.
8767b1ab
FC
73Missing name in "our sub" at - line 1.
74########
75# NAME Missing name in "state sub"
e7d0b801 76use 5.01; use feature 'lexical_subs';
8767b1ab
FC
77state sub;
78EXPECT
64fbf0dd 79The lexical_subs feature is experimental at - line 2.
8767b1ab
FC
80Missing name in "state sub" at - line 2.
81########
a21eb52b
FC
82# NAME my sub pack::foo
83use feature 'lexical_subs', 'state';
84my sub foo::bar;
85state sub foo::bear;
86EXPECT
87The lexical_subs feature is experimental at - line 2.
88The lexical_subs feature is experimental at - line 3.
89"my" subroutine &foo::bar can't be in a package at - line 2, near "my sub foo::bar"
90"state" subroutine &foo::bear can't be in a package at - line 3, near "state sub foo::bear"
91Execution of - aborted due to compilation errors.
92########
b2e3d01a
FC
93# NAME Integer constant overloading returning undef
94use overload;
247a7f40
FC
95BEGIN { overload::constant integer => sub {}; undef *^H }
961
97EXPECT
bb4784f0 98Constant(1) unknown at - line 3, at end of line
247a7f40
FC
99Execution of - aborted due to compilation errors.
100########
101# NAME Float constant overloading returning undef
102use overload;
103BEGIN { overload::constant float => sub {}; undef *^H }
1041.1
105EXPECT
bb4784f0 106Constant(1.1) unknown at - line 3, at end of line
247a7f40
FC
107Execution of - aborted due to compilation errors.
108########
109# NAME Binary constant overloading returning undef
110use overload;
111BEGIN { overload::constant binary => sub {}; undef *^H }
1120x1
113EXPECT
bb4784f0 114Constant(0x1) unknown at - line 3, at end of line
247a7f40
FC
115Execution of - aborted due to compilation errors.
116########
117# NAME String constant overloading returning undef
118use overload;
119BEGIN { overload::constant q => sub {}; undef *^H }
120'1', "1$_", tr"a"", s""a"
121EXPECT
122Constant(q) unknown at - line 3, near "'1'"
123Constant(qq) unknown at - line 3, within string
124Constant(tr) unknown at - line 3, within string
125Constant(s) unknown at - line 3, within string
126Execution of - aborted due to compilation errors.
127########
128# NAME Regexp constant overloading when *^H is undefined
129use overload;
130BEGIN { overload::constant qr => sub {}; undef *^H }
131/a/, m'a'
132EXPECT
133Constant(qq) unknown at - line 3, within pattern
134Constant(q) unknown at - line 3, within pattern
135Execution of - aborted due to compilation errors.
136########
137# NAME \N{...} when charnames fails to load but without an error
d4ead2eb 138# SKIP ? exists $ENV{PERL_UNICODE} ? "Unreliable under some PERL_UNICODE settings" : 0
247a7f40
FC
139BEGIN { ++$_ for @INC{"charnames.pm","_charnames.pm"} }
140"\N{a}"
141EXPECT
142Constant(\N{a}) unknown at - line 2, within string
143Execution of - aborted due to compilation errors.
144########
145# NAME Integer constant overloading returning undef
146use overload;
b2e3d01a
FC
147BEGIN { overload::constant integer => sub {} }
1481
149EXPECT
bb4784f0 150Constant(1): Call to &{$^H{integer}} did not return a defined value at - line 3, at end of line
b2e3d01a
FC
151Execution of - aborted due to compilation errors.
152########
153# NAME Float constant overloading returning undef
154use overload;
155BEGIN { overload::constant float => sub {} }
1561.1
157EXPECT
bb4784f0 158Constant(1.1): Call to &{$^H{float}} did not return a defined value at - line 3, at end of line
b2e3d01a
FC
159Execution of - aborted due to compilation errors.
160########
161# NAME Binary constant overloading returning undef
162use overload;
163BEGIN { overload::constant binary => sub {} }
1640x1
165EXPECT
bb4784f0 166Constant(0x1): Call to &{$^H{binary}} did not return a defined value at - line 3, at end of line
b2e3d01a
FC
167Execution of - aborted due to compilation errors.
168########
169# NAME String constant overloading returning undef
170use overload;
171BEGIN { overload::constant q => sub {} }
172'1', "1$_", tr"a"", s""a"
173EXPECT
174Constant(q): Call to &{$^H{q}} did not return a defined value at - line 3, near "'1'"
175Constant(qq): Call to &{$^H{q}} did not return a defined value at - line 3, within string
176Constant(tr): Call to &{$^H{q}} did not return a defined value at - line 3, within string
177Constant(s): Call to &{$^H{q}} did not return a defined value at - line 3, within string
178Execution of - aborted due to compilation errors.
179########
180# NAME Regexp constant overloading returning undef
181use overload;
182BEGIN { overload::constant qr => sub {} }
183/a/, m'a'
184EXPECT
185Constant(qq): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern
186Constant(q): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern
187Execution of - aborted due to compilation errors.
188########
67c71cbb
FC
189# NAME Failed constant overloading should not cause a double free
190use overload;
191BEGIN { overload::constant q => sub {}; undef *^H }
192undef(1,2);
193undef(1,2);
194undef(1,2);
195undef(1,2);
196undef(1,2);
197undef(1,2);
198undef(1,2);
199undef(1,2);
200undef(1,2);
201"a"
202EXPECT
203Too many arguments for undef operator at - line 3, near "2)"
204Too many arguments for undef operator at - line 4, near "2)"
205Too many arguments for undef operator at - line 5, near "2)"
206Too many arguments for undef operator at - line 6, near "2)"
207Too many arguments for undef operator at - line 7, near "2)"
208Too many arguments for undef operator at - line 8, near "2)"
209Too many arguments for undef operator at - line 9, near "2)"
210Too many arguments for undef operator at - line 10, near "2)"
211Too many arguments for undef operator at - line 11, near "2)"
212Constant(q) unknown at - line 12, near ""a""
213- has too many errors.
214########
6f2d7fc9
FC
215# NAME Unterminated delimiter for here document
216<<"foo
217EXPECT
218Unterminated delimiter for here document at - line 1.