Move Test::Harness from ext/ to cpan/
[p5sagit/p5-mst-13.2.git] / cpan / Test-Harness / t / process.t
CommitLineData
b965d173 1#!/usr/bin/perl -w
2
3use strict;
4use lib 't/lib';
5
6my $hires;
7
8BEGIN {
9 $hires = eval 'use Time::HiRes qw(sleep); 1';
10}
11
f7c69158 12use Test::More (
13 $^O eq 'VMS' ? ( skip_all => 'VMS' )
14 : $hires ? ( tests => 9 * 3 )
15 : ( skip_all => 'Need Time::HiRes' )
16);
b965d173 17
18use File::Spec;
19use TAP::Parser::Iterator::Process;
20
21my @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 30my $source = File::Spec->catfile(
27fc0087 31 't',
32 'sample-tests',
33 'delayed'
f7c69158 34);
b965d173 35
36for my $chunk_size ( 1, 4, 65536 ) {
37 for my $where ( 0 .. 8 ) {
38
39 my $proc = TAP::Parser::Iterator::Process->new(
40 { _chunk_size => $chunk_size,
41 command => [ $^X, $source, ( 1 << $where ) ]
42 }
43 );
44
45 my @got = ();
46 while ( defined( my $line = $proc->next_raw ) ) {
47 push @got, $line;
48 }
49
50 is_deeply \@got, \@expect,
51 "I/O ok with delay at position $where, chunk size $chunk_size";
52 }
53}