]> git.vpit.fr Git - perl/modules/Test-Leaner.git/blob - t/20-ok.t
Fall back to Test::More when PERL_TEST_LEANER_USES_TEST_MORE is set
[perl/modules/Test-Leaner.git] / t / 20-ok.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 BEGIN { delete $ENV{PERL_TEST_LEANER_USES_TEST_MORE} }
7
8 use Test::Leaner tests => 4 + 1 + 2 + 1;
9
10 ok 1;
11 ok !!1,    'ok() test with a description';
12 ok 0.001,  'a float is fine too';
13 ok +{},    'a hash ref is fine too';
14
15 my @array = (undef);
16 ok @array, 'ok() forces scalar context';
17
18 my $ret = ok 1;
19 ok $ret, 'ok(true) returns true';
20
21 {
22  package Test::Leaner::TestOverload::AlwaysFalse;
23
24  use overload 'bool' => sub { 1 };
25
26  sub new { bless { }, shift }
27 }
28
29 my $z = Test::Leaner::TestOverload::AlwaysFalse->new;
30
31 ok $z, 'ok($overloaded_true)';