1#!/usr/bin/perl -w 2# HARNESS-NO-STREAM 3# HARNESS-NO-PRELOAD 4 5BEGIN { 6 if( $ENV{PERL_CORE} ) { 7 chdir 't'; 8 @INC = ('../lib', 'lib'); 9 } 10 else { 11 unshift @INC, 't/lib'; 12 } 13} 14 15use strict; 16 17require Test::Simple::Catch; 18my($out, $err) = Test::Simple::Catch::caught(); 19 20# Can't use Test.pm, that's a 5.005 thing. 21package My::Test; 22 23# This has to be a require or else the END block below runs before 24# Test::Builder's own and the ending diagnostics don't come out right. 25require Test::Builder; 26my $TB = Test::Builder->create; 27$TB->plan(tests => 2); 28 29sub is { $TB->is_eq(@_) } 30 31 32package main; 33 34require Test::Simple; 35Test::Simple->import(tests => 1); 36ok(1); 37ok(1); 38ok(1); 39 40END { 41 My::Test::is($$out, <<OUT); 421..1 43ok 1 44ok 2 45ok 3 46OUT 47 48 My::Test::is($$err, <<ERR); 49# Looks like you planned 1 test but ran 3. 50ERR 51 52 # Prevent Test::Simple from existing with non-zero 53 exit 0; 54} 55