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