Test::Simple 0.32
[p5sagit/p5-mst-13.2.git] / t / lib / Test / Simple / Catch.pm
1 # For testing Test::Simple;
2 package Test::Simple::Catch;
3
4 use Symbol;
5 my($out_fh, $err_fh) = (gensym, gensym);
6 my $out = tie *$out_fh, __PACKAGE__;
7 my $err = tie *$err_fh, __PACKAGE__;
8
9 use Test::Builder;
10 my $t = Test::Builder->new;
11 $t->output($out_fh);
12 $t->failure_output($err_fh);
13 $t->todo_output($err_fh);
14
15 sub caught { return($out, $err) }
16
17 sub PRINT  {
18     my $self = shift;
19     $$self .= join '', @_;
20 }
21
22 sub TIEHANDLE {
23     my $class = shift;
24     my $self = '';
25     return bless \$self, $class;
26 }
27 sub READ {}
28 sub READLINE {}
29 sub GETC {}
30 sub FILENO {}
31
32 1;