4 if( $ENV{PERL_CORE} ) {
6 @INC = ('../lib', 'lib');
13 use File::Spec::Functions;
15 my $SAMPLE_TESTS = $ENV{PERL_CORE}
16 ? catdir(curdir(), 'lib', 'sample-tests')
17 : catdir(curdir(), 't', 'sample-tests');
21 # For shutting up Test::Harness.
22 # Has to work on 5.004 which doesn't have Tie::StdHandle.
23 package My::Dev::Null;
30 my $fh = do { local *HANDLE; \*HANDLE };
31 return bless $fh, $class;
42 my $IsVMS = $^O eq 'VMS';
43 my $IsMacOS = $^O eq 'MacOS';
45 # VMS uses native, not POSIX, exit codes.
46 my $die_estat = $IsVMS ? 44 : $IsMacOS ? 0 : 1;
400 'shbang_misparse' => {
418 plan tests => (keys(%samples) * 7) + 1;
421 use_ok('Test::Harness');
424 tie *NULL, 'My::Dev::Null' or die $!;
426 while (my($test, $expect) = each %samples) {
427 # _run_all_tests() runs the tests but skips the formatting.
428 my($totals, $failed);
431 select NULL; # _run_all_tests() isn't as quiet as it should be.
432 local $SIG{__WARN__} = sub { $warning .= join '', @_; };
434 Test::Harness::_run_all_tests(catfile($SAMPLE_TESTS, $test));
439 skip "special tests for bailout", 1 unless $test eq 'bailout';
440 like( $@, '/Further testing stopped: GERONI/i' );
444 skip "don't apply to a bailout", 5 if $test eq 'bailout';
446 is( Test::Harness::_all_ok($totals), $expect->{all_ok},
448 ok( defined $expect->{total}, "$test - has total" );
449 is_deeply( {map { $_=>$totals->{$_} } keys %{$expect->{total}}},
452 is_deeply( {map { $_=>$failed->{catfile($SAMPLE_TESTS, $test)}{$_} }
453 keys %{$expect->{failed}}},
459 skip "special tests for bignum", 1 unless $test eq 'bignum';
460 is( $warning, <<WARN );
461 Enourmous test number seen [test 100001]
462 Can't detailize, too big.
463 Enourmous test number seen [test 136211425]
464 Can't detailize, too big.