]> git.vpit.fr Git - perl/modules/Test-Leaner.git/blobdiff - t/20-ok.t
Test ok() return value, with overloading, and failing
[perl/modules/Test-Leaner.git] / t / 20-ok.t
index 9bc35ad8e3debe17859867757bd38332db16d38d..e6fcafe8063cb8f27643ef95e0b9e3bdd9c30f3a 100644 (file)
--- a/t/20-ok.t
+++ b/t/20-ok.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::Leaner tests => 4 + 1;
+use Test::Leaner tests => 4 + 1 + 2 + 1;
 
 ok 1;
 ok !!1,    'ok() test with a description';
@@ -12,3 +12,18 @@ ok +{},    'a hash ref is fine too';
 
 my @array = (undef);
 ok @array, 'ok() forces scalar context';
+
+my $ret = ok 1;
+ok $ret, 'ok(true) returns true';
+
+{
+ package Test::Leaner::TestOverload::AlwaysFalse;
+
+ use overload 'bool' => sub { 1 };
+
+ sub new { bless { }, shift }
+}
+
+my $z = Test::Leaner::TestOverload::AlwaysFalse->new;
+
+ok $z, 'ok($overloaded_true)';