1N/A#!perl -w
1N/A
1N/ABEGIN {
1N/A if( $ENV{PERL_CORE} ) {
1N/A chdir 't';
1N/A @INC = ('../lib', 'lib');
1N/A }
1N/A else {
1N/A unshift @INC, 't/lib';
1N/A }
1N/A}
1N/A
1N/Ause strict;
1N/A
1N/Arequire Test::Simple::Catch;
1N/Amy($out, $err) = Test::Simple::Catch::caught();
1N/A
1N/A
1N/A# Can't use Test.pm, that's a 5.005 thing.
1N/Apackage My::Test;
1N/A
1N/Aprint "1..2\n";
1N/A
1N/Amy $test_num = 1;
1N/A# Utility testing functions.
1N/Asub ok ($;$) {
1N/A my($test, $name) = @_;
1N/A my $ok = '';
1N/A $ok .= "not " unless $test;
1N/A $ok .= "ok $test_num";
1N/A $ok .= " - $name" if defined $name;
1N/A $ok .= "\n";
1N/A print $ok;
1N/A $test_num++;
1N/A}
1N/A
1N/A
1N/Apackage main;
1N/A
1N/Arequire Test::Simple;
1N/ATest::Simple->import(tests => 5);
1N/A
1N/A#line 35
1N/Aok( 1, 'passing' );
1N/Aok( 2, 'passing still' );
1N/Aok( 3, 'still passing' );
1N/Aok( 0, 'oh no!' );
1N/Aok( 0, 'damnit' );
1N/A
1N/A
1N/AEND {
1N/A My::Test::ok($$out eq <<OUT);
1N/A1..5
1N/Aok 1 - passing
1N/Aok 2 - passing still
1N/Aok 3 - still passing
1N/Anot ok 4 - oh no!
1N/Anot ok 5 - damnit
1N/AOUT
1N/A
1N/A My::Test::ok($$err eq <<ERR);
1N/A# Failed test ($0 at line 38)
1N/A# Failed test ($0 at line 39)
1N/A# Looks like you failed 2 tests of 5.
1N/AERR
1N/A
1N/A # Prevent Test::Simple from exiting with non zero
1N/A exit 0;
1N/A}