On Sat, Oct 26, 2002 at 04:22:49PM +0100, Nicholas Clark wrote:
> However, I'd like to be able to cleanly print out my random number seed to
> STDERR (or whatever Test::Builder's correct name for this is) if it believes
> that any tests have failed, and I can't see a clean way to do this.

In an END block, grab the T::B object and check the summary().

  #!/usr/bin/perl -w

  use Test::More tests => 1;

  pass('foo');

  END { 
      my $failed = grep!$_, Test::More->builder->summary;
      diag $failed ? "Failed\n" : "Passed\n";
  }

The only trouble there is if the test as a whole fails during the ending,
like because the wrong number of tests were run or the exit code was odd,
the above logic is too simple to know that.  You have to go through the
sort of logic _ending() does.

Not sure to add in an ending callback or an is_passing() method.  Or both.


BTW  How does one get the current srand if you use the one set by Perl?


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl Quality Assurance      <[EMAIL PROTECTED]>         Kwalitee Is Job One
I'm not actually Kevin Lenzo, but I play him on TV.

Reply via email to