Skip to content

Instantly share code, notes, and snippets.

@exodist
Created January 13, 2011 06:52
Show Gist options
  • Save exodist/777505 to your computer and use it in GitHub Desktop.
Save exodist/777505 to your computer and use it in GitHub Desktop.
What gives?
#!/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