1# HARNESS-NO-STREAM 2# HARNESS-NO-PRELOAD 3 4BEGIN { 5 if( $ENV{PERL_CORE} ) { 6 chdir 't'; 7 @INC = ('../lib', 'lib'); 8 } 9 else { 10 unshift @INC, 't/lib'; 11 } 12} 13 14# Can't use Test.pm, that's a 5.005 thing. 15package My::Test; 16 17# This has to be a require or else the END block below runs before 18# Test::Builder's own and the ending diagnostics don't come out right. 19require Test::Builder; 20my $TB = Test::Builder->create; 21$TB->plan(tests => 2); 22 23sub is { $TB->is_eq(@_) } 24 25 26package main; 27 28require Test::Simple; 29 30require Test::Simple::Catch; 31my($out, $err) = Test::Simple::Catch::caught(); 32local $ENV{HARNESS_ACTIVE} = 0; 33 34Test::Simple->import(tests => 5); 35 36#line 30 37ok(1, 'Foo'); 38ok(0, 'Bar'); 39ok(1, '1 2 3'); 40 41END { 42 My::Test::is($$out, <<OUT); 431..5 44ok 1 - Foo 45not ok 2 - Bar 46ok 3 - 1 2 3 47OUT 48 49 My::Test::is($$err, <<ERR); 50# Failed test 'Bar' 51# at $0 line 31. 52# You named your test '1 2 3'. You shouldn't use numbers for your test names. 53# Very confusing. 54# Looks like you planned 5 tests but ran 3. 55# Looks like you failed 1 test of 3 run. 56ERR 57 58 exit 0; 59} 60