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');
25 my $IsMacPerl = $^O eq 'MacOS';
26 my $IsVMS = $^O eq 'VMS';
28 # VMS uses native, not POSIX, exit codes.
29 # MacPerl's exit codes are broken.
30 my $die_estat = $IsVMS ? 44 :
420 'shbang_misparse' => {
472 plan tests => (keys(%samples) * 8);
475 $Test::Harness::Switches = '"-Mstrict"';
477 tie *NULL, 'Dev::Null' or die $!;
479 for my $test ( sort keys %samples ) {
481 skip "-t introduced in 5.8.0", 8 if $test eq 'taint_warn' and $] < 5.008;
483 my $expect = $samples{$test};
485 # _run_all_tests() runs the tests but skips the formatting.
486 my($totals, $failed);
488 my $test_path = File::Spec->catfile($SAMPLE_TESTS, $test);
490 print STDERR "# $test\n" if $ENV{TEST_VERBOSE};
492 select NULL; # _run_all_tests() isn't as quiet as it should be.
493 local $SIG{__WARN__} = sub { $warning .= join '', @_; };
495 Test::Harness::_run_all_tests($test_path);
499 # $? is unreliable in MacPerl, so we'll just fudge it.
500 $failed->{estat} = $die_estat if $IsMacPerl and $failed;
503 skip "special tests for bailout", 1 unless $test eq 'bailout';
504 like( $@, '/Further testing stopped: GERONI/i' );
508 skip "don't apply to a bailout", 5 if $test eq 'bailout';
510 is( Test::Harness::_all_ok($totals), $expect->{all_ok},
512 ok( defined $expect->{total}, "$test - has total" );
513 is_deeply( {map { $_=>$totals->{$_} } keys %{$expect->{total}}},
516 is_deeply( {map { $_=>$failed->{$test_path}{$_} }
517 keys %{$expect->{failed}}},
523 skip "special tests for bignum", 1 unless $test eq 'bignum';
524 is( $warning, <<WARN );
525 Enormous test number seen [test 100001]
526 Can't detailize, too big.
527 Enormous test number seen [test 136211425]
528 Can't detailize, too big.
534 skip "bignum has known warnings", 1 if $test eq 'bignum';