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
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Don't cross the streams (Score:1)
The benefit of done_testing() is that you can be certain that "we got this far and ran this line of code."
But there's nothing like that in your subtest sub {}, so you can't be sure that there wasn't some a goto(), exit(), or return() which silently caused a bunch of tests to be skipped.
Similarly, END {done_testing()} does nothing that wasn't already accomplished by 'no_plan'. Calling done_testing() at the lexical end of your file is an assertion about control flow.
Thus, an implicit done_testing() on a 'without plan' subtest is redundant. But there are three modes here and your subtest() examples only show two: 1. plan, 2. no plan, 3. lexical plan (aka done_testing()). So:
subtest sub {
ok(1, 'whatever');
done_testing()
};
And why not 'with_plan'/'without_plan' so we can use the quoting of the fat arrow?
Reply to This
Re: (Score:2)
Good points out the normal use of done_testing(). That was silly of me :)
As for the implicit version in subtests, you won't get that with "no_plan", either, something many people are going to use anyway, if they use tests at all (well, the "exit" isn't true, but your comments about "goto" and "return" are correct). Now I think you've made the clearest arguments about this, but your arguments apply to "no_plan", also. Would you argue we not have that? We do and it won't go away.
One argument in favor of h