Ovid wrote:
> The latter is virtually impossible to read but it's a fairly common
> complaint.  But I think that provides us with our answer.  The streams
> only need to be in synch when runtests (or prove) is in VERBOSE mode. 
> There is no information lost and everyone's happy, yes?  Otherwise, let
> STDERR be STDERR and the problem is solved.  Does this work?

Yes!  That's quite the nice knot chopping you've done there.  I'm quite happy
with that.

Mulling it, there are the odd cases where you're going to get things like this:

$ cat ~/tmp/foo.t
#!/usr/bin/perl -w

$| = 1;

print "1..2\n";
print "ok 1\n";
print STDERR "# This is about the next failure.  It should be shown.\n";
print "not ok 2\n";
print STDERR "# This is after the last failure.\n";


$ prove ~/tmp/foo.t
/Users/schwern/tmp/foo....# This is about the next failure.  It should be shown.
# This is after the last failure.
/Users/schwern/tmp/foo....FAILED test 2
        Failed 1/2 tests, 50.00% okay
Failed Test              Stat Wstat Total Fail  List of Failed
-------------------------------------------------------------------------------
/Users/schwern/tmp/foo.t                2    1  2
Failed 1/1 test scripts. 1/2 subtests failed.
Files=1, Tests=2,  0 wallclock secs ( 0.00 cusr +  0.00 csys =  0.00 CPU)
Failed 1/1 test programs. 1/2 subtests failed.


$ runtests ~/tmp/foo.t
/Users/schwern/tmp/foo......1/2 # This is about the next failure.  It should
be shown.
/Users/schwern/tmp/foo......2/2 # This is after the last failure.
/Users/schwern/tmp/foo...... Failed 1/2 subtests

Test Summary Report
-------------------
/Users/schwern/tmp/foo.t (Wstat: 0 Tests: 2 Failed: 1)
  Failed tests:  2
Files=1, Tests=2,  0 wallclock secs ( 0.00 cusr +  0.00 csys =  0.00 CPU)



Note how with prove both diagnostics come out before the test is declared to
have failed while runtests gets them in the right order.  However, this is
pretty minor as I believe folks are already used to messy failure output.

Reply via email to