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' => {
457 plan tests => (keys(%samples) * 8) + 1;
460 use_ok('Test::Harness');
463 tie *NULL, 'My::Dev::Null' or die $!;
465 while (my($test, $expect) = each %samples) {
466 # _run_all_tests() runs the tests but skips the formatting.
467 my($totals, $failed);
469 my $test_path = File::Spec->catfile($SAMPLE_TESTS, $test);
472 select NULL; # _run_all_tests() isn't as quiet as it should be.
473 local $SIG{__WARN__} = sub { $warning .= join '', @_; };
475 Test::Harness::_run_all_tests($test_path);
479 # $? is unreliable in MacPerl, so we'll just fudge it.
480 $failed->{estat} = $die_estat if $IsMacPerl and $failed;
483 skip "special tests for bailout", 1 unless $test eq 'bailout';
484 like( $@, '/Further testing stopped: GERONI/i' );
488 skip "don't apply to a bailout", 5 if $test eq 'bailout';
490 is( Test::Harness::_all_ok($totals), $expect->{all_ok},
492 ok( defined $expect->{total}, "$test - has total" );
493 is_deeply( {map { $_=>$totals->{$_} } keys %{$expect->{total}}},
496 is_deeply( {map { $_=>$failed->{$test_path}{$_} }
497 keys %{$expect->{failed}}},
503 skip "special tests for bignum", 1 unless $test eq 'bignum';
504 is( $warning, <<WARN );
505 Enormous test number seen [test 100001]
506 Can't detailize, too big.
507 Enormous test number seen [test 136211425]
508 Can't detailize, too big.
514 skip "bignum has known warnings", 1 if $test eq 'bignum';