4 if( $ENV{PERL_CORE} ) {
6 @INC = ('../lib', 'lib');
16 my $Curdir = File::Spec->curdir;
17 my $SAMPLE_TESTS = $ENV{PERL_CORE}
18 ? File::Spec->catdir($Curdir, 'lib', 'sample-tests')
19 : File::Spec->catdir($Curdir, 't', 'sample-tests');
22 # For shutting up Test::Harness.
23 # Has to work on 5.004 which doesn't have Tie::StdHandle.
24 package My::Dev::Null;
31 my $fh = do { local *HANDLE; \*HANDLE };
32 return bless $fh, $class;
43 my $IsMacPerl = $^O eq 'MacOS';
44 my $IsVMS = $^O eq 'VMS';
46 # VMS uses native, not POSIX, exit codes.
47 # MacPerl's exit codes are broken.
48 my $die_estat = $IsVMS ? 44 :
421 'shbang_misparse' => {
473 plan tests => (keys(%samples) * 8) + 1;
475 use_ok('Test::Harness');
476 use Test::Harness; # So that we don't get "used only once" warnings on the next line
477 $Test::Harness::Switches = '"-Mstrict"';
479 tie *NULL, 'My::Dev::Null' or die $!;
481 while (my($test, $expect) = each %samples) {
482 # _run_all_tests() runs the tests but skips the formatting.
483 my($totals, $failed);
485 my $test_path = File::Spec->catfile($SAMPLE_TESTS, $test);
488 select NULL; # _run_all_tests() isn't as quiet as it should be.
489 local $SIG{__WARN__} = sub { $warning .= join '', @_; };
491 Test::Harness::_run_all_tests($test_path);
495 # $? is unreliable in MacPerl, so we'll just fudge it.
496 $failed->{estat} = $die_estat if $IsMacPerl and $failed;
499 skip "special tests for bailout", 1 unless $test eq 'bailout';
500 like( $@, '/Further testing stopped: GERONI/i' );
504 skip "don't apply to a bailout", 5 if $test eq 'bailout';
506 is( Test::Harness::_all_ok($totals), $expect->{all_ok},
508 ok( defined $expect->{total}, "$test - has total" );
509 is_deeply( {map { $_=>$totals->{$_} } keys %{$expect->{total}}},
512 is_deeply( {map { $_=>$failed->{$test_path}{$_} }
513 keys %{$expect->{failed}}},
519 skip "special tests for bignum", 1 unless $test eq 'bignum';
520 is( $warning, <<WARN );
521 Enormous test number seen [test 100001]
522 Can't detailize, too big.
523 Enormous test number seen [test 136211425]
524 Can't detailize, too big.
530 skip "bignum has known warnings", 1 if $test eq 'bignum';