David Cantrell wrote: > On Thu, Feb 05, 2009 at 10:00:38AM +0200, Gabor Szabo wrote: > >> You might want to report error if both plan(2) and add_plan(2) was >> called in the same file. > > Or you might not. > > plan(2); > # generic tests > ok(...); > ok(...); > if($ENV{RUN_REALLY_SLOW_TESTS}) { > add_plan(2); > ok(...); > ok(...); > } > done_testing();
Test::NoWarnings, which has to add a test without you knowing, would find that advantageous. I also allowed this: use Test::More 'no_plan'; pass(); pass(); done_testing(2); I'm not entirely sure why you'd do it, maybe if a human writes "no_plan" but a module issues the done_testing(), but I can't think of a strong reason to make it fail. Separating adding to the plan from declaring a plan is also a good idea. Rather than make a new function, plan() already takes key/values so plan(add => $num_tests) would seem to be the way to do it. Also, Test::More must know that your plan is additive so it knows to issue the TAP plan at the end. So this won't work: use Test::More tests => 1; # at this point, "1..1" is printed pass; plan add => 1; # what now? pass; So you'd do this: use Test::More; plan add => 1; pass; plan add => 1; pass; Though we don't have incremental TAP plans, Test::Builder can check that you've run all the tests you said you'd run before you add more. Thus... use Test::More; plan add => 2; pass; plan add => 1; pass; # failure pass; Thoughts? -- You know what the chain of command is? It's the chain I go get and beat you with 'til you understand who's in ruttin' command here. -- Jayne Cobb, "Firefly"