X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FTest%2FLeaner.pm;h=1efe7a295183bf1f285b059b82cc57fe635c9b24;hb=e3217cb5d83d1ae15f1795bef7c885740607689b;hp=4f5327580106e339ac8b87566805459544aa6d52;hpb=95d98c140e711be6185a7ff61ac78668ebc91155;p=perl%2Fmodules%2FTest-Leaner.git diff --git a/lib/Test/Leaner.pm b/lib/Test/Leaner.pm index 4f53275..1efe7a2 100644 --- a/lib/Test/Leaner.pm +++ b/lib/Test/Leaner.pm @@ -28,6 +28,12 @@ BEGIN { my $TAP_STREAM = *STDOUT; my $DIAG_STREAM = *STDERR; +for ($TAP_STREAM, $DIAG_STREAM) { + my $fh = select $_; + $|++; + select $fh; +} + my ($plan, $test, $failed, $no_diag, $done_testing); sub NO_PLAN () { -1 } @@ -35,7 +41,7 @@ sub SKIP_ALL () { -2 } BEGIN { if (THREADSAFE) { - threads::shared::share($_) for $plan, $test, $failed, $no_diag; + threads::shared::share($_) for $plan, $test, $failed, $no_diag, $done_testing; } lock $plan if THREADSAFE; @@ -96,12 +102,6 @@ sub plan { croak("plan() doesn't understand @args"); } - { - my $fh = select $TAP_STREAM; - $|++; - select $fh; - } - if (defined $plan_str) { local $\; print $TAP_STREAM "$plan_str\n"; @@ -143,6 +143,7 @@ sub import { push @imports, @{ $_[$i+1] }; $splice = 2; } elsif ($item eq 'no_diag') { + lock $plan if THREADSAFE; $no_diag = 1; $splice = 1; } @@ -183,6 +184,8 @@ sub skip { } for (1 .. $count) { + ++$test; + my $skip_str = "ok $test # skip"; if (defined $reason) { sanitize_comment($reason); @@ -191,8 +194,6 @@ sub skip { local $\; print $TAP_STREAM "$skip_str\n"; - - $test++; } no warnings 'exiting';