This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test error when constant overload handler returns undef
[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;
33BEGIN { overload::constant integer => sub {} }
341
35EXPECT
36Constant(undef): Call to &{$^H{integer}} did not return a defined value 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 {} }
421.1
43EXPECT
44Constant(undef): Call to &{$^H{float}} did not return a defined value 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 {} }
500x1
51EXPECT
52Constant(undef): Call to &{$^H{binary}} did not return a defined value 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 {} }
58'1', "1$_", tr"a"", s""a"
59EXPECT
60Constant(q): Call to &{$^H{q}} did not return a defined value at - line 3, near "'1'"
61Constant(qq): Call to &{$^H{q}} did not return a defined value at - line 3, within string
62Constant(tr): Call to &{$^H{q}} did not return a defined value at - line 3, within string
63Constant(s): Call to &{$^H{q}} did not return a defined value at - line 3, within string
64Execution of - aborted due to compilation errors.
65########
66# NAME Regexp constant overloading returning undef
67use overload;
68BEGIN { overload::constant qr => sub {} }
69/a/, m'a'
70EXPECT
71Constant(qq): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern
72Constant(q): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern
73Execution of - aborted due to compilation errors.
74########
6f2d7fc9
FC
75# NAME Unterminated delimiter for here document
76<<"foo
77EXPECT
78Unterminated delimiter for here document at - line 1.