From: Father Chrysostomos Date: Fri, 7 Dec 2012 14:09:45 +0000 (-0800) Subject: Test error when constant overload handler returns undef X-Git-Tag: upstream/5.20.0~4570 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2e3d01a1a3d82b7b763c5fc9fc5b4213638d41f;p=platform%2Fupstream%2Fperl.git Test error when constant overload handler returns undef --- diff --git a/t/lib/croak/toke b/t/lib/croak/toke index acfab57..7251767 100644 --- a/t/lib/croak/toke +++ b/t/lib/croak/toke @@ -28,6 +28,50 @@ EXPECT The lexical_subs feature is experimental at - line 2. Missing name in "state sub" at - line 2. ######## +# NAME Integer constant overloading returning undef +use overload; +BEGIN { overload::constant integer => sub {} } +1 +EXPECT +Constant(undef): Call to &{$^H{integer}} did not return a defined value 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 {} } +1.1 +EXPECT +Constant(undef): Call to &{$^H{float}} did not return a defined value 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 {} } +0x1 +EXPECT +Constant(undef): Call to &{$^H{binary}} did not return a defined value 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 {} } +'1', "1$_", tr"a"", s""a" +EXPECT +Constant(q): Call to &{$^H{q}} did not return a defined value at - line 3, near "'1'" +Constant(qq): Call to &{$^H{q}} did not return a defined value at - line 3, within string +Constant(tr): Call to &{$^H{q}} did not return a defined value at - line 3, within string +Constant(s): Call to &{$^H{q}} did not return a defined value at - line 3, within string +Execution of - aborted due to compilation errors. +######## +# NAME Regexp constant overloading returning undef +use overload; +BEGIN { overload::constant qr => sub {} } +/a/, m'a' +EXPECT +Constant(qq): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern +Constant(q): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern +Execution of - aborted due to compilation errors. +######## # NAME Unterminated delimiter for here document <<"foo EXPECT