1#!/usr/bin/perl -w 2 3BEGIN { 4 if( $ENV{PERL_CORE} ) { 5 chdir 't'; 6 @INC = ('../lib', 'lib'); 7 } 8 else { 9 unshift @INC, 't/lib'; 10 } 11} 12 13use strict; 14 15# Normalize the output whether we're running under Test::Harness or not. 16local $ENV{HARNESS_ACTIVE} = 0; 17 18use Test::Builder; 19use Test::Builder::NoOutput; 20 21# TB methods expect to be wrapped 22my $ok = sub { shift->ok(@_) }; 23my $plan = sub { shift->plan(@_) }; 24my $done_testing = sub { shift->done_testing(@_) }; 25 26my $Test = Test::Builder->new; 27 28{ 29 my $tb = Test::Builder::NoOutput->create; 30 31 $tb->$plan( tests => 1 ); 32 33#line 28 34 $tb->$ok(0); 35 $tb->_ending; 36 37 $Test->is_eq($tb->read('out'), <<OUT); 381..1 39not ok 1 40OUT 41 42 $Test->is_eq($tb->read('err'), <<ERR); 43# Failed test at $0 line 28. 44# Looks like you failed 1 test of 1. 45ERR 46 47 $Test->$done_testing(2); 48} 49