From: Vincent Pit Date: Fri, 21 Jan 2011 12:48:22 +0000 (+0100) Subject: Test that ok() really honors 'bool' overloading X-Git-Tag: v0.03~15 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Leaner.git;a=commitdiff_plain;h=6112420fe6b1f9ae44eebaf445d0f076a953970b Test that ok() really honors 'bool' overloading --- diff --git a/t/20-ok.t b/t/20-ok.t index 19e989a..4aeba2b 100644 --- a/t/20-ok.t +++ b/t/20-ok.t @@ -19,13 +19,16 @@ my $ret = ok 1; ok $ret, 'ok(true) returns true'; { - package Test::Leaner::TestOverload::AlwaysFalse; + package Test::Leaner::TestOverload::AlwaysTrue; - use overload 'bool' => sub { 1 }; + use overload ( + 'bool' => sub { 1 }, + '""' => sub { '' }, + ); sub new { bless { }, shift } } -my $z = Test::Leaner::TestOverload::AlwaysFalse->new; +my $z = Test::Leaner::TestOverload::AlwaysTrue->new; ok $z, 'ok($overloaded_true)'; diff --git a/t/21-ok-failing.t b/t/21-ok-failing.t index c54fde8..36ab420 100644 --- a/t/21-ok-failing.t +++ b/t/21-ok-failing.t @@ -54,7 +54,10 @@ reset_buffer { { package Test::Leaner::TestOverload::AlwaysFalse; - use overload 'bool' => sub { !1 }; + use overload ( + 'bool' => sub { !1 }, + '""' => sub { 'true' }, + ); sub new { bless { }, shift } }