Hi all,

I've just uploaded Test::Most 0.02 to the cpan.  Aside from Test::Warn,
I've added deferred plans using a patch from barefootcoder++ (Buddy
Burden).  Example, the following will pass with Test::More 'no_plan':

  use Test::More 'no_plan';
  ok 1;
  exit;
  ok 2;

You can now guarantee that this will fail:

  use Test::Most 'defer_plan';
  ok 1;
  exit;
  ok 2;
  all_done;

Whee!

Of course, if knowing the number of tests is an expensive calculation,
you can still specify the plan at the end:

  use Test::Most 'defer_plan';
  use My::Tests;
  my $tests_expected = My::Tests->run;
  all_done($tests_expected);

The latter, of course, should assert the number of tests you expected
to run, not the number of tests you've actually run.  Otherwise, it's
not much better than "no_plan" (except you're still protected from
premature exits.

Cheers,
Ovid

--
Buy the book  - http://www.oreilly.com/catalog/perlhks/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog     - http://use.perl.org/~Ovid/journal/

Reply via email to