This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test ‘Constant(%s) unknown’ error
[perl5.git] / t / lib / croak / toke
CommitLineData
ca8ffed2 1__END__
5af08aed
FC
2# NAME Unterminated here-doc in string eval
3eval "<<foo"; die $@
4EXPECT
5Can't find string terminator "foo" anywhere before EOF at (eval 1) line 1.
6########
7# NAME Unterminated here-doc in s/// string eval
8eval "s//<<foo/e"; die $@
9EXPECT
10Can't find string terminator "foo" anywhere before EOF at (eval 1) line 1.
11########
ca8ffed2 12# NAME Missing name in "my sub"
e7d0b801 13use feature 'lexical_subs'; my sub;
ca8ffed2 14EXPECT
e7d0b801 15The lexical_subs feature is experimental at - line 1.
ca8ffed2 16Missing name in "my sub" at - line 1.
6f2d7fc9 17########
8767b1ab 18# NAME Missing name in "our sub"
e7d0b801 19use feature 'lexical_subs'; our sub;
8767b1ab 20EXPECT
e7d0b801 21The lexical_subs feature is experimental at - line 1.
8767b1ab
FC
22Missing name in "our sub" at - line 1.
23########
24# NAME Missing name in "state sub"
e7d0b801 25use 5.01; use feature 'lexical_subs';
8767b1ab
FC
26state sub;
27EXPECT
64fbf0dd 28The lexical_subs feature is experimental at - line 2.
8767b1ab
FC
29Missing name in "state sub" at - line 2.
30########
b2e3d01a
FC
31# NAME Integer constant overloading returning undef
32use overload;
247a7f40
FC
33BEGIN { overload::constant integer => sub {}; undef *^H }
341
35EXPECT
36Constant(undef) unknown at - line 3, at end of line
37Execution of - aborted due to compilation errors.
38########
39# NAME Float constant overloading returning undef
40use overload;
41BEGIN { overload::constant float => sub {}; undef *^H }
421.1
43EXPECT
44Constant(undef) unknown at - line 3, at end of line
45Execution of - aborted due to compilation errors.
46########
47# NAME Binary constant overloading returning undef
48use overload;
49BEGIN { overload::constant binary => sub {}; undef *^H }
500x1
51EXPECT
52Constant(undef) unknown at - line 3, at end of line
53Execution of - aborted due to compilation errors.
54########
55# NAME String constant overloading returning undef
56use overload;
57BEGIN { overload::constant q => sub {}; undef *^H }
58'1', "1$_", tr"a"", s""a"
59EXPECT
60Constant(q) unknown at - line 3, near "'1'"
61Constant(qq) unknown at - line 3, within string
62Constant(tr) unknown at - line 3, within string
63Constant(s) unknown at - line 3, within string
64Execution of - aborted due to compilation errors.
65########
66# NAME Regexp constant overloading when *^H is undefined
67use overload;
68BEGIN { overload::constant qr => sub {}; undef *^H }
69/a/, m'a'
70EXPECT
71Constant(qq) unknown at - line 3, within pattern
72Constant(q) unknown at - line 3, within pattern
73Execution of - aborted due to compilation errors.
74########
75# NAME \N{...} when charnames fails to load but without an error
76BEGIN { ++$_ for @INC{"charnames.pm","_charnames.pm"} }
77"\N{a}"
78EXPECT
79Constant(\N{a}) unknown at - line 2, within string
80Execution of - aborted due to compilation errors.
81########
82# NAME Integer constant overloading returning undef
83use overload;
b2e3d01a
FC
84BEGIN { overload::constant integer => sub {} }
851
86EXPECT
87Constant(undef): Call to &{$^H{integer}} did not return a defined value at - line 3, at end of line
88Execution of - aborted due to compilation errors.
89########
90# NAME Float constant overloading returning undef
91use overload;
92BEGIN { overload::constant float => sub {} }
931.1
94EXPECT
95Constant(undef): Call to &{$^H{float}} did not return a defined value at - line 3, at end of line
96Execution of - aborted due to compilation errors.
97########
98# NAME Binary constant overloading returning undef
99use overload;
100BEGIN { overload::constant binary => sub {} }
1010x1
102EXPECT
103Constant(undef): Call to &{$^H{binary}} did not return a defined value at - line 3, at end of line
104Execution of - aborted due to compilation errors.
105########
106# NAME String constant overloading returning undef
107use overload;
108BEGIN { overload::constant q => sub {} }
109'1', "1$_", tr"a"", s""a"
110EXPECT
111Constant(q): Call to &{$^H{q}} did not return a defined value at - line 3, near "'1'"
112Constant(qq): Call to &{$^H{q}} did not return a defined value at - line 3, within string
113Constant(tr): Call to &{$^H{q}} did not return a defined value at - line 3, within string
114Constant(s): Call to &{$^H{q}} did not return a defined value at - line 3, within string
115Execution of - aborted due to compilation errors.
116########
117# NAME Regexp constant overloading returning undef
118use overload;
119BEGIN { overload::constant qr => sub {} }
120/a/, m'a'
121EXPECT
122Constant(qq): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern
123Constant(q): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern
124Execution of - aborted due to compilation errors.
125########
6f2d7fc9
FC
126# NAME Unterminated delimiter for here document
127<<"foo
128EXPECT
129Unterminated delimiter for here document at - line 1.