Created
January 13, 2011 06:52
-
-
Save exodist/777505 to your computer and use it in GitHub Desktop.
What gives?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
our $TBOUT; | |
BEGIN { | |
if ( eval { require Test::Builder; 1 }) { | |
my $Testout; | |
open( $Testout, '>', \$TBOUT ) || die $!; | |
my $old_fh = select $Testout; | |
$| = 1; | |
select $old_fh; | |
no warnings 'redefine'; | |
*Test::Builder::reset_outputs = sub { | |
my $self = shift; | |
$self->output ($Testout); | |
$self->failure_output($Testout); | |
$self->todo_output ($Testout); | |
return; | |
}; | |
Test::Builder->new->reset_outputs; | |
} | |
} | |
use Test::More; | |
ok( 1 ); | |
ok( 0, "blah" ); | |
is( 1, 2, "hup" ); | |
$TBOUT =~ s/^([^#])/# $1/gm; | |
print( $TBOUT ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment