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 use vars qw($Total_tests %samples);
40 plan tests => $Total_tests;
42 use_ok('Test::Harness');
371 $Total_tests = (keys(%samples) * 4) + 1;
374 tie *NULL, 'My::Dev::Null' or die $!;
376 while (my($test, $expect) = each %samples) {
377 # _run_all_tests() runs the tests but skips the formatting.
378 my($totals, $failed);
380 select NULL; # _run_all_tests() isn't as quiet as it should be.
382 Test::Harness::_run_all_tests("$SAMPLE_TESTS/$test");
387 is( Test::Harness::_all_ok($totals), $expect->{all_ok},
389 ok( defined $expect->{total}, "$test - has total" );
390 is_deeply( {map { $_=>$totals->{$_} } keys %{$expect->{total}}},
393 is_deeply( {map { $_=>$failed->{"$SAMPLE_TESTS/$test"}{$_} }
394 keys %{$expect->{failed}}},
398 else { # special case for bailout
399 is( $test, 'bailout' );
400 like( $@, '/Further testing stopped: GERONI/i', $test );
401 pass( 'skipping for bailout' );
402 pass( 'skipping for bailout' );