4 if( $ENV{PERL_CORE} ) {
6 @INC = ('../lib', 'lib');
15 my $Test = Test::Builder->new;
17 $Test->plan( tests => 9 );
22 $Test->is_num( scalar $Test->summary(), 0, 'no tests yet, no summary' );
23 push @Expected_Details, { 'ok' => 1,
25 name => 'no tests yet, no summary',
30 # Inline TODO tests will confuse pre 1.20 Test::Harness, so we
31 # should just avoid the problem and not print it out.
32 my $out_fh = $Test->output;
33 my $todo_fh = $Test->todo_output;
34 my $start_test = $Test->current_test + 1;
38 $Test->todo_output(\*FH);
41 $Test->skip( 'just testing skip' );
43 push @Expected_Details, { 'ok' => 1,
47 reason => 'just testing skip',
51 local $TODO = 'i need a todo';
52 $Test->ok( 0, 'a test to todo!' );
54 push @Expected_Details, { 'ok' => 1,
56 name => 'a test to todo!',
58 reason => 'i need a todo',
61 $Test->todo_skip( 'i need both' );
63 push @Expected_Details, { 'ok' => 1,
67 reason => 'i need both'
70 for ($start_test..$Test->current_test) { print "ok $_\n" }
71 $Test->output($out_fh);
72 $Test->todo_output($todo_fh);
74 $Test->is_num( scalar $Test->summary(), 4, 'summary' );
75 push @Expected_Details, { 'ok' => 1,
82 $Test->current_test(6);
83 print "ok 6 - current_test incremented\n";
84 push @Expected_Details, { 'ok' => 1,
88 reason => 'incrementing test number',
91 my @details = $Test->details();
92 $Test->is_num( scalar @details, 6,
93 'details() should return a list of all test details');
96 is_deeply( \@details, \@Expected_Details );
99 # This test has to come last because it thrashes the test details.
101 my $curr_test = $Test->current_test;
102 $Test->current_test(4);
103 my @details = $Test->details();
105 $Test->current_test($curr_test);
106 $Test->is_num( scalar @details, 4 );