From 247a7f40cd18f049b85ee008433addbd3069717a Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Fri, 7 Dec 2012 06:25:24 -0800 Subject: [PATCH] =?utf8?q?Test=20=E2=80=98Constant(%s)=20unknown=E2=80=99?= =?utf8?q?=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This only happens if someone accidentally (or intentionally :-) unde- fines %^H or *^H or stops charnames from loading. --- t/lib/croak/toke | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/t/lib/croak/toke b/t/lib/croak/toke index 7251767..cd1fc20 100644 --- a/t/lib/croak/toke +++ b/t/lib/croak/toke @@ -30,6 +30,57 @@ Missing name in "state sub" at - line 2. ######## # NAME Integer constant overloading returning undef use overload; +BEGIN { overload::constant integer => sub {}; undef *^H } +1 +EXPECT +Constant(undef) unknown at - line 3, at end of line +Execution of - aborted due to compilation errors. +######## +# NAME Float constant overloading returning undef +use overload; +BEGIN { overload::constant float => sub {}; undef *^H } +1.1 +EXPECT +Constant(undef) unknown at - line 3, at end of line +Execution of - aborted due to compilation errors. +######## +# NAME Binary constant overloading returning undef +use overload; +BEGIN { overload::constant binary => sub {}; undef *^H } +0x1 +EXPECT +Constant(undef) unknown at - line 3, at end of line +Execution of - aborted due to compilation errors. +######## +# NAME String constant overloading returning undef +use overload; +BEGIN { overload::constant q => sub {}; undef *^H } +'1', "1$_", tr"a"", s""a" +EXPECT +Constant(q) unknown at - line 3, near "'1'" +Constant(qq) unknown at - line 3, within string +Constant(tr) unknown at - line 3, within string +Constant(s) unknown at - line 3, within string +Execution of - aborted due to compilation errors. +######## +# NAME Regexp constant overloading when *^H is undefined +use overload; +BEGIN { overload::constant qr => sub {}; undef *^H } +/a/, m'a' +EXPECT +Constant(qq) unknown at - line 3, within pattern +Constant(q) unknown at - line 3, within pattern +Execution of - aborted due to compilation errors. +######## +# NAME \N{...} when charnames fails to load but without an error +BEGIN { ++$_ for @INC{"charnames.pm","_charnames.pm"} } +"\N{a}" +EXPECT +Constant(\N{a}) unknown at - line 2, within string +Execution of - aborted due to compilation errors. +######## +# NAME Integer constant overloading returning undef +use overload; BEGIN { overload::constant integer => sub {} } 1 EXPECT -- 2.7.4