Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Wednesday June 18, 2008
03:25 PM

Test::Most now has deferred plans

[ #36715 ]

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;
ok 2;

You can now guarantee that this will fail:

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


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;

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).

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.