3 # Test Test::Builder->reset;
6 if( $ENV{PERL_CORE} ) {
8 @INC = ('../lib', 'lib');
11 unshift @INC, 't/lib';
18 my $tb = Test::Builder->new;
19 $tb->plan(tests => 14);
22 # Alter the state of Test::Builder as much as possible.
23 $tb->ok(1, "Running a test to alter TB's state");
25 my $tmpfile = 'foo.tmp';
27 $tb->output($tmpfile);
28 $tb->failure_output($tmpfile);
29 $tb->todo_output($tmpfile);
30 END { unlink $tmpfile }
32 # This won't print since we just sent output off to oblivion.
33 $tb->ok(0, "And a failure for fun");
35 $Test::Builder::Level = 3;
37 $tb->exported_to('Foofer');
47 my $test_num = 2; # since we already printed 1
48 # Utility testing functions.
50 my($test, $name) = @_;
52 $ok .= "not " unless $test;
53 $ok .= "ok $test_num";
54 $ok .= " - $name" if defined $name;
63 ok( !defined $tb->exported_to, 'exported_to' );
64 ok( $tb->expected_tests == 0, 'expected_tests' );
65 ok( $tb->level == 1, 'level' );
66 ok( $tb->use_numbers == 1, 'use_numbers' );
67 ok( $tb->no_header == 0, 'no_header' );
68 ok( $tb->no_ending == 0, 'no_ending' );
69 ok( fileno $tb->output == fileno *Test::Builder::TESTOUT,
71 ok( fileno $tb->failure_output == fileno *Test::Builder::TESTERR,
73 ok( fileno $tb->todo_output == fileno *Test::Builder::TESTOUT,
75 ok( $tb->current_test == 0, 'current_test' );
76 ok( $tb->summary == 0, 'summary' );
77 ok( $tb->details == 0, 'details' );
81 $tb->plan(tests => 14);
82 $tb->current_test(13);
84 $tb->ok(1, 'final test to make sure output was reset');