Commit | Line | Data |
b965d173 |
1 | #!/usr/bin/perl -w |
2 | |
3 | use strict; |
4 | use lib 't/lib'; |
5 | |
6 | my $hires; |
7 | |
8 | BEGIN { |
9 | $hires = eval 'use Time::HiRes qw(sleep); 1'; |
10 | } |
11 | |
12 | use Test::More ( $^O eq 'VMS' ? ( skip_all => 'VMS' ) |
13 | : $hires ? ( tests => 9 * 3 ) |
14 | : ( skip_all => 'Need Time::HiRes' ) ); |
15 | |
16 | use File::Spec; |
17 | use TAP::Parser::Iterator::Process; |
18 | |
19 | my @expect = ( |
20 | '1..5', |
21 | 'ok 1 00000', |
22 | 'ok 2', |
23 | 'not ok 3', |
24 | 'ok 4', |
25 | 'ok 5 00000', |
26 | ); |
27 | |
28 | my $source = File::Spec->catfile( ($ENV{PERL_CORE} ? 'lib' : 't'), |
29 | 'sample-tests', 'delayed' ); |
30 | |
31 | for my $chunk_size ( 1, 4, 65536 ) { |
32 | for my $where ( 0 .. 8 ) { |
33 | |
34 | my $proc = TAP::Parser::Iterator::Process->new( |
35 | { _chunk_size => $chunk_size, |
36 | command => [ $^X, $source, ( 1 << $where ) ] |
37 | } |
38 | ); |
39 | |
40 | my @got = (); |
41 | while ( defined( my $line = $proc->next_raw ) ) { |
42 | push @got, $line; |
43 | } |
44 | |
45 | is_deeply \@got, \@expect, |
46 | "I/O ok with delay at position $where, chunk size $chunk_size"; |
47 | } |
48 | } |