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 $IsMacOS = $^O eq 'MacOS';
44 my $IsVMS = $^O eq 'VMS';
46 # VMS uses native, not POSIX, exit codes.
47 my $die_estat = $IsVMS ? 44 : $IsMacOS ? 0 : 1;
401 'shbang_misparse' => {
419 plan tests => (keys(%samples) * 8) + 1;
422 use_ok('Test::Harness');
425 tie *NULL, 'My::Dev::Null' or die $!;
427 while (my($test, $expect) = each %samples) {
428 # _run_all_tests() runs the tests but skips the formatting.
429 my($totals, $failed);
431 my $test_path = File::Spec->catfile($SAMPLE_TESTS, $test);
434 select NULL; # _run_all_tests() isn't as quiet as it should be.
435 local $SIG{__WARN__} = sub { $warning .= join '', @_; };
437 Test::Harness::_run_all_tests($test_path);
441 # $? is unreliable in MacPerl, so we'll simply fudge it.
442 $failed->{estat} = $die_estat if $IsMacOS and $failed;
445 skip "special tests for bailout", 1 unless $test eq 'bailout';
446 like( $@, '/Further testing stopped: GERONI/i' );
450 skip "don't apply to a bailout", 5 if $test eq 'bailout';
452 is( Test::Harness::_all_ok($totals), $expect->{all_ok},
454 ok( defined $expect->{total}, "$test - has total" );
455 is_deeply( {map { $_=>$totals->{$_} } keys %{$expect->{total}}},
458 is_deeply( {map { $_=>$failed->{$test_path}{$_} }
459 keys %{$expect->{failed}}},
465 skip "special tests for bignum", 1 unless $test eq 'bignum';
466 is( $warning, <<WARN );
467 Enormous test number seen [test 100001]
468 Can't detailize, too big.
469 Enormous test number seen [test 136211425]
470 Can't detailize, too big.
476 skip "bignum has known warnings", 1 if $test eq 'bignum';