4 if( $ENV{PERL_CORE} ) {
6 @INC = ('../lib', 'lib');
13 my $SAMPLE_TESTS = $ENV{PERL_CORE} ? "lib/sample-tests" : "t/sample-tests";
17 # For shutting up Test::Harness.
18 # Has to work on 5.004 which doesn't have Tie::StdHandle.
19 package My::Dev::Null;
26 my $fh = do { local *HANDLE; \*HANDLE };
27 return bless $fh, $class;
38 my $IsVMS = $^O eq 'VMS';
40 # VMS uses native, not POSIX, exit codes.
41 my $die_estat = $IsVMS ? 44 : 1;
42 my $die_wstat = $IsVMS ? 1024 : 256;
369 plan tests => (keys(%samples) * 4) + 1;
372 use_ok('Test::Harness');
375 tie *NULL, 'My::Dev::Null' or die $!;
377 while (my($test, $expect) = each %samples) {
378 # _run_all_tests() runs the tests but skips the formatting.
379 my($totals, $failed);
381 select NULL; # _run_all_tests() isn't as quiet as it should be.
383 Test::Harness::_run_all_tests("$SAMPLE_TESTS/$test");
388 is( Test::Harness::_all_ok($totals), $expect->{all_ok},
390 ok( defined $expect->{total}, "$test - has total" );
391 is_deeply( {map { $_=>$totals->{$_} } keys %{$expect->{total}}},
394 is_deeply( {map { $_=>$failed->{"$SAMPLE_TESTS/$test"}{$_} }
395 keys %{$expect->{failed}}},
399 else { # special case for bailout
400 is( $test, 'bailout' );
401 like( $@, '/Further testing stopped: GERONI/i', $test );
402 pass( 'skipping for bailout' );
403 pass( 'skipping for bailout' );