Commit | Line | Data |
---|---|---|
4dd974da | 1 | # For testing Test::Simple; |
d020a79a | 2 | package Test::Simple::Catch; |
4dd974da | 3 | |
33459055 | 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__; | |
4dd974da | 8 | |
33459055 | 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); | |
4dd974da | 14 | |
33459055 | 15 | sub caught { return($out, $err) } |
4dd974da | 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 {} | |
33459055 | 30 | sub FILENO {} |
4dd974da | 31 | |
32 | 1; |