3 # Test Test::Builder->reset;
6 if( $ENV{PERL_CORE} ) {
8 @INC = ('../lib', 'lib');
11 unshift @INC, 't/lib';
18 my $Test = Test::Builder->new;
19 my $tb = Test::Builder->create;
21 # We'll need this later to know the outputs were reset
23 $Original_Output{$_} = $tb->$_ for qw(output failure_output todo_output);
25 # Alter the state of Test::Builder as much as possible.
27 $tb->output(\$output);
28 $tb->failure_output(\$output);
29 $tb->todo_output(\$output);
31 $tb->plan(tests => 14);
34 $tb->ok(1, "Running a test to alter TB's state");
36 # This won't print since we just sent output off to oblivion.
37 $tb->ok(0, "And a failure for fun");
39 $Test::Builder::Level = 3;
41 $tb->exported_to('Foofer');
52 $Test->ok( !defined $tb->exported_to, 'exported_to' );
53 $Test->is_eq( $tb->expected_tests, 0, 'expected_tests' );
54 $Test->is_eq( $tb->level, 1, 'level' );
55 $Test->is_eq( $tb->use_numbers, 1, 'use_numbers' );
56 $Test->is_eq( $tb->no_header, 0, 'no_header' );
57 $Test->is_eq( $tb->no_ending, 0, 'no_ending' );
58 $Test->is_eq( $tb->current_test, 0, 'current_test' );
59 $Test->is_eq( scalar $tb->summary, 0, 'summary' );
60 $Test->is_eq( scalar $tb->details, 0, 'details' );
61 $Test->is_eq( fileno $tb->output,
62 fileno $Original_Output{output}, 'output' );
63 $Test->is_eq( fileno $tb->failure_output,
64 fileno $Original_Output{failure_output}, 'failure_output' );
65 $Test->is_eq( fileno $tb->todo_output,
66 fileno $Original_Output{todo_output}, 'todo_output' );
68 $tb->current_test(12);
70 $tb->ok(1, 'final test to make sure output was reset');
72 $Test->current_test(13);
73 $Test->done_testing(13);