xref: /openbsd-src/gnu/usr.bin/perl/cpan/Test-Simple/t/lib/Test/Simple/Catch.pm (revision 5759b3d249badf144a6240f7eec4dcf9df003e6b)
1b39c5158Smillert# For testing Test::Simple;
2b39c5158Smillertpackage Test::Simple::Catch;
3b39c5158Smillert
4b39c5158Smillertuse strict;
5b39c5158Smillert
6b39c5158Smillertuse Symbol;
7b39c5158Smillertuse TieOut;
8b39c5158Smillertmy( $out_fh, $err_fh ) = ( gensym, gensym );
9b39c5158Smillertmy $out = tie *$out_fh, 'TieOut';
10b39c5158Smillertmy $err = tie *$err_fh, 'TieOut';
11b39c5158Smillert
12b39c5158Smillertuse Test::Builder;
13*5759b3d2Safresh1require Test::Builder::Formatter;
14b39c5158Smillertmy $t = Test::Builder->new;
15*5759b3d2Safresh1$t->{Stack}->top->format(Test::Builder::Formatter->new);
16b39c5158Smillert$t->output($out_fh);
17b39c5158Smillert$t->failure_output($err_fh);
18b39c5158Smillert$t->todo_output($err_fh);
19b39c5158Smillert
20b39c5158Smillertsub caught { return( $out, $err ) }
21b39c5158Smillert
22b39c5158Smillert1;
23