#!/usr/bin/perl -w use strict; use lib 't/lib'; # We're going to need to override exit() later BEGIN { *CORE::GLOBAL::exit = sub(;$) { my $status = @_ ? 0 : shift; CORE::exit $status; }; } use Test::More; use Test::Builder; use Test::Builder::NoOutput; { my $tb = Test::Builder::NoOutput->create; ok $tb->is_passing, "a fresh TB object is passing"; $tb->ok(1); ok $tb->is_passing, " still passing after a test"; $tb->ok(0); ok !$tb->is_passing, " not passing after a failing test"; $tb->ok(1); ok !$tb->is_passing, " a passing test doesn't resurrect it"; $tb->done_testing(3); ok !$tb->is_passing, " a successful plan doesn't help either"; } # See if is_passing() notices a plan overrun { my $tb = Test::Builder::NoOutput->create; $tb->plan( tests => 1 ); $tb->ok(1); ok $tb->is_passing, "Passing with a plan"; $tb->ok(1); ok !$tb->is_passing, " passing test, but it overran the plan"; } # is_passing() vs no_plan { my $tb = Test::Builder::NoOutput->create; $tb->plan( "no_plan" ); ok $tb->is_passing, "Passing with no_plan"; $tb->ok(1); ok $tb->is_passing, " still passing after a test"; $tb->ok(1); ok $tb->is_passing, " and another test"; $tb->_ending; ok $tb->is_passing, " and after the ending"; } # is_passing() vs skip_all { my $tb = Test::Builder::NoOutput->create; { no warnings 'redefine'; local *CORE::GLOBAL::exit = sub { return 1; }; $tb->plan( "skip_all" ); } ok $tb->is_passing, "Passing with skip_all"; } # is_passing() vs done_testing(#) { my $tb = Test::Builder::NoOutput->create; $tb->ok(1); $tb->done_testing(2); ok !$tb->is_passing, "All tests passed but done_testing() does not match"; } # is_passing() with no tests run vs done_testing() { my $tb = Test::Builder::NoOutput->create; $tb->done_testing(); ok !$tb->is_passing, "No tests run with done_testing()"; } # is_passing() with no tests run vs done_testing() { my $tb = Test::Builder::NoOutput->create; $tb->ok(1); $tb->done_testing(); ok $tb->is_passing, "All tests passed with done_testing()"; } done_testing();
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Builder.t | File | 635 B | 0644 |
|
carp.t | File | 587 B | 0644 |
|
create.t | File | 818 B | 0644 |
|
current_test.t | File | 259 B | 0644 |
|
current_test_without_plan.t | File | 233 B | 0644 |
|
details.t | File | 2.98 KB | 0644 |
|
done_testing.t | File | 235 B | 0644 |
|
done_testing_double.t | File | 912 B | 0644 |
|
done_testing_plan_mismatch.t | File | 787 B | 0644 |
|
done_testing_with_no_plan.t | File | 152 B | 0644 |
|
done_testing_with_number.t | File | 236 B | 0644 |
|
done_testing_with_plan.t | File | 153 B | 0644 |
|
fork_with_new_stdout.t | File | 907 B | 0644 |
|
has_plan.t | File | 366 B | 0644 |
|
has_plan2.t | File | 355 B | 0644 |
|
is_fh.t | File | 975 B | 0644 |
|
is_passing.t | File | 2.2 KB | 0644 |
|
maybe_regex.t | File | 1.28 KB | 0644 |
|
no_diag.t | File | 148 B | 0644 |
|
no_ending.t | File | 345 B | 0644 |
|
no_header.t | File | 298 B | 0644 |
|
no_plan_at_all.t | File | 722 B | 0644 |
|
ok_obj.t | File | 462 B | 0644 |
|
output.t | File | 1.95 KB | 0644 |
|
reset.t | File | 2 KB | 0644 |
|
reset_outputs.t | File | 784 B | 0644 |
|
try.t | File | 747 B | 0644 |
|