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;
368 'shbang_misparse' => {
386 plan tests => (keys(%samples) * 7) + 1;
389 use_ok('Test::Harness');
392 tie *NULL, 'My::Dev::Null' or die $!;
394 while (my($test, $expect) = each %samples) {
395 # _run_all_tests() runs the tests but skips the formatting.
396 my($totals, $failed);
399 select NULL; # _run_all_tests() isn't as quiet as it should be.
400 local $SIG{__WARN__} = sub { $warning .= join '', @_; };
402 Test::Harness::_run_all_tests(catfile($SAMPLE_TESTS, $test));
407 skip "special tests for bailout", 1 unless $test eq 'bailout';
408 like( $@, '/Further testing stopped: GERONI/i' );
412 skip "don't apply to a bailout", 5 if $test eq 'bailout';
414 is( Test::Harness::_all_ok($totals), $expect->{all_ok},
416 ok( defined $expect->{total}, "$test - has total" );
417 is_deeply( {map { $_=>$totals->{$_} } keys %{$expect->{total}}},
420 is_deeply( {map { $_=>$failed->{catfile($SAMPLE_TESTS, $test)}{$_} }
421 keys %{$expect->{failed}}},
427 skip "special tests for bignum", 1 unless $test eq 'bignum';
428 is( $warning, <<WARN );
429 Enourmous test number seen [test 100001]
430 Can't detailize, too big.
431 Enourmous test number seen [test 136211425]
432 Can't detailize, too big.