Plan 9 from Bell Labs’s /usr/web/sources/contrib/gabidiaz/root/sys/src/cmd/perl/t/lib/Test/Simple/Catch.pm

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


# For testing Test::Simple;
package Test::Simple::Catch;

use Symbol;
my($out_fh, $err_fh) = (gensym, gensym);
my $out = tie *$out_fh, __PACKAGE__;
my $err = tie *$err_fh, __PACKAGE__;

use Test::Builder;
my $t = Test::Builder->new;
$t->output($out_fh);
$t->failure_output($err_fh);
$t->todo_output($err_fh);

sub caught { return($out, $err) }

sub PRINT  {
    my $self = shift;
    $$self .= join '', @_;
}

sub TIEHANDLE {
    my $class = shift;
    my $self = '';
    return bless \$self, $class;
}
sub READ {}
sub READLINE {}
sub GETC {}
sub FILENO {}

1;

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].