aboutsummaryrefslogtreecommitdiffstats
path: root/yamlishwriter-php-v0.0.1/t/harness.t
blob: abc51f8bd0c152a00f649c864afa0cd629010154 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use strict;
use warnings;

my $php = $ENV{PHP} || 'php';

my $TESTS = 't/*.php';

my $planned = 0;

for my $test ( glob( $TESTS ) ) {
    warn "# $test\n";
    my $offset = $planned;
    my @command = ( $php, $test );
    open my $th, '-|', @command or die "Can't run $test ($?)\n";
    while ( defined( my $line = <$th> ) ) {
        chomp $line;
        if ( $line =~ /^1..(\d+)/ ) {
            $planned += $1;
        }
        else {
            $line =~ s/^((?:not\s+)?ok\s+)(\d+)/$1 . ($2 + $offset)/e;
            print "$line\n";
        }
    }
    close $th or die "Can't run $test ($?)\n";
}

# Trailing plan
print "1..$planned\n";