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 | |
f7c69158 |
12 | use Test::More ( |
13 | $^O eq 'VMS' ? ( skip_all => 'VMS' ) |
14 | : $hires ? ( tests => 9 * 3 ) |
15 | : ( skip_all => 'Need Time::HiRes' ) |
16 | ); |
b965d173 |
17 | |
18 | use File::Spec; |
19 | use TAP::Parser::Iterator::Process; |
20 | |
21 | my @expect = ( |
22 | '1..5', |
23 | 'ok 1 00000', |
24 | 'ok 2', |
25 | 'not ok 3', |
26 | 'ok 4', |
27 | 'ok 5 00000', |
28 | ); |
29 | |
f7c69158 |
30 | my $source = File::Spec->catfile( |
27fc0087 |
31 | ( $ENV{PERL_CORE} |
32 | ? ( File::Spec->updir(), 'ext', 'Test', 'Harness' ) |
33 | : () |
34 | ), |
35 | 't', |
36 | 'sample-tests', |
37 | 'delayed' |
f7c69158 |
38 | ); |
b965d173 |
39 | |
40 | for my $chunk_size ( 1, 4, 65536 ) { |
41 | for my $where ( 0 .. 8 ) { |
42 | |
43 | my $proc = TAP::Parser::Iterator::Process->new( |
44 | { _chunk_size => $chunk_size, |
45 | command => [ $^X, $source, ( 1 << $where ) ] |
46 | } |
47 | ); |
48 | |
49 | my @got = (); |
50 | while ( defined( my $line = $proc->next_raw ) ) { |
51 | push @got, $line; |
52 | } |
53 | |
54 | is_deeply \@got, \@expect, |
55 | "I/O ok with delay at position $where, chunk size $chunk_size"; |
56 | } |
57 | } |