1#!perl -w
2
3BEGIN {
4    if( $ENV{PERL_CORE} ) {
5        chdir 't';
6        @INC = ('../lib', 'lib');
7    }
8    else {
9        unshift @INC, 't/lib';
10    }
11}
12
13use Test::Builder;
14use Test::More 'no_plan';
15
16{
17    my $tb = Test::Builder->create();
18
19    # Store the original output filehandles and change them all.
20    my %original_outputs;
21
22    open my $fh, ">", "dummy_file.tmp";
23    END { 1 while unlink "dummy_file.tmp"; }
24    for my $method (qw(output failure_output todo_output)) {
25        $original_outputs{$method} = $tb->$method();
26        $tb->$method($fh);
27        is $tb->$method(), $fh;
28    }
29
30    $tb->reset_outputs;
31
32    for my $method (qw(output failure_output todo_output)) {
33        is $tb->$method(), $original_outputs{$method}, "reset_outputs() resets $method";
34    }
35}
36