6 use Test::More qw( no_plan );
10 use TAP::Parser::Multiplexer;
11 use TAP::Parser::Iterator::Process;
14 = TAP::Parser::Iterator::Process->_use_open3
19 { name => 'Single non-selectable source',
21 # Returns a list of parser, stash pairs. The stash contains the
22 # TAP that we expect from this parser.
30 TAP::Parser->new( { tap => join( "\n", @tap ) . "\n" } ),
35 { name => 'Two non-selectable sources',
48 [ TAP::Parser->new( { tap => join( "\n", @$_ ) . "\n" } ),
54 { name => 'Single selectable source',
58 { source => File::Spec->catfile(
59 ( $ENV{PERL_CORE} ? 'lib' : 't' ), 'sample-tests',
74 { name => 'Three selectable sources',
78 { source => File::Spec->catfile(
79 ( $ENV{PERL_CORE} ? 'lib' : 't' ),
80 'sample-tests', 'simple'
95 { name => 'Three selectable sources, two non-selectable sources',
110 { tap => join( "\n", @$_ ) . "\n" }
118 { source => File::Spec->catfile(
119 ( $ENV{PERL_CORE} ? 'lib' : 't' ),
120 'sample-tests', 'simple'
138 for my $test (@schedule) {
139 my $name = "$test->{name} ($fork_desc)";
140 my @sources = $test->{sources}->();
141 my $mux = TAP::Parser::Multiplexer->new;
143 my $count = @sources;
144 $mux->add(@$_) for @sources;
146 is $mux->parsers, $count, "$name: count OK";
148 while ( my ( $parser, $stash, $result ) = $mux->next ) {
151 # diag Dumper( { stash => $stash, result => $result } );
152 if ( defined $result ) {
153 my $expect = ( shift @$stash ) || ' OOPS ';
154 my $got = $result->raw;
155 is $got, $expect, "$name: '$expect' OK";
158 ok @$stash == 0, "$name: EOF OK";
160 # Make sure we only get one EOF per stream
161 push @$stash, ' expect no more ';
164 is $mux->parsers, 0, "$name: All used up";