6
# We're going to need to override exit() later
8
*CORE::GLOBAL::exit = sub(;$) {
9
my $status = @_ ? 0 : shift;
16
use Test::Builder::NoOutput;
19
my $tb = Test::Builder::NoOutput->create;
20
ok $tb->is_passing, "a fresh TB object is passing";
23
ok $tb->is_passing, " still passing after a test";
26
ok !$tb->is_passing, " not passing after a failing test";
29
ok !$tb->is_passing, " a passing test doesn't resurrect it";
32
ok !$tb->is_passing, " a successful plan doesn't help either";
36
# See if is_passing() notices a plan overrun
38
my $tb = Test::Builder::NoOutput->create;
39
$tb->plan( tests => 1 );
41
ok $tb->is_passing, "Passing with a plan";
44
ok !$tb->is_passing, " passing test, but it overran the plan";
48
# is_passing() vs no_plan
50
my $tb = Test::Builder::NoOutput->create;
51
$tb->plan( "no_plan" );
52
ok $tb->is_passing, "Passing with no_plan";
55
ok $tb->is_passing, " still passing after a test";
58
ok $tb->is_passing, " and another test";
61
ok $tb->is_passing, " and after the ending";
65
# is_passing() vs skip_all
67
my $tb = Test::Builder::NoOutput->create;
70
no warnings 'redefine';
71
local *CORE::GLOBAL::exit = sub {
74
$tb->plan( "skip_all" );
76
ok $tb->is_passing, "Passing with skip_all";
80
# is_passing() vs done_testing(#)
82
my $tb = Test::Builder::NoOutput->create;
85
ok !$tb->is_passing, "All tests passed but done_testing() does not match";
89
# is_passing() with no tests run vs done_testing()
91
my $tb = Test::Builder::NoOutput->create;
93
ok !$tb->is_passing, "No tests run with done_testing()";
97
# is_passing() with no tests run vs done_testing()
99
my $tb = Test::Builder::NoOutput->create;
102
ok $tb->is_passing, "All tests passed with done_testing()";