6 use Test::More tests => 10;
9 use TAP::Parser::IteratorFactory;
11 my $tap = <<'END_TAP';
13 ok 1 - input file opened
15 not ok first line of the input valid # todo some data
17 ok 3 - read the rest of the file
18 not ok 4 - this is a real failure
19 ok 5 # skip we have no description
30 $todo++ if $test->has_todo;
31 $skip++ if $test->has_skip;
35 $plan_output = $plan->as_string;
39 my $factory = TAP::Parser::IteratorFactory->new;
40 my $stream = $factory->make_iterator( [ split /\n/ => $tap ] );
41 my $parser = TAP::Parser->new(
43 callbacks => \%callbacks,
47 can_ok $parser, 'run';
49 is $plan_output, '1..5', 'Plan callbacks should succeed';
50 is scalar @tests, $parser->tests_run, '... as should the test callbacks';
63 $todo++ if $test->has_todo;
64 $skip++ if $test->has_skip;
68 $plan_output = $plan->as_string;
71 $end = 1 if $all == 8;
81 $stream = $factory->make_iterator( [ split /\n/ => $tap ] );
82 $parser = TAP::Parser->new(
84 callbacks => \%callbacks,
88 can_ok $parser, 'run';
90 is $plan_output, '1..5', 'Plan callbacks should succeed';
91 is scalar @tests, $parser->tests_run, '... as should the test callbacks';
92 is $else, 2, '... and the correct number of "ELSE" lines should be seen';
93 is $all, 8, '... and the correct total number of lines should be seen';
94 is $end, 1, 'EOF callback correctly called';
96 # Check callback name policing
106 $stream = $factory->make_iterator( [ split /\n/ => $tap ] );
108 $parser = TAP::Parser->new(
110 callbacks => \%callbacks,
115 like $@, qr/Callback/, 'Bad callback keys faulted';