From: Graham Knop Date: Fri, 21 Feb 2014 03:13:36 +0000 (-0500) Subject: test that class overloads aren't overwritten X-Git-Tag: v1.003003~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=83a5e1e3cdf761aa3b8f48d10aa0911685d3bba6;p=gitmo%2FRole-Tiny.git test that class overloads aren't overwritten --- diff --git a/t/overload.t b/t/overload.t index 9e83c55..41ab0c7 100644 --- a/t/overload.t +++ b/t/overload.t @@ -22,9 +22,21 @@ BEGIN { sub new { bless {}, shift } } +BEGIN { + package MyClass2; + use overload fallback => 0; + use Role::Tiny::With; + with 'MyRole'; + sub new { bless {}, shift } +} + my $o = MyClass->new; is "$o", 'welp', 'subref overload'; is 0+$o, 219, 'method name overload'; ok !!$o, 'anon subref overload'; +my $o2 = MyClass2->new; +eval { my $f = 0+$o2 }; +like $@, qr/no method found/, 'fallback value not overwritten'; + done_testing;