From: Vincent Pit Date: Sat, 25 Dec 2010 11:04:55 +0000 (+0100) Subject: Turn autoflush on as soon as the module is loaded X-Git-Tag: v0.01~18 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Leaner.git;a=commitdiff_plain;h=e3217cb5d83d1ae15f1795bef7c885740607689b Turn autoflush on as soon as the module is loaded With done_testing(), it is valid to run tests before outputting the plan. --- diff --git a/lib/Test/Leaner.pm b/lib/Test/Leaner.pm index 9e39fe5..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 } @@ -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";