I'm so glad for done_testing(). I don't like no_plan, but done_testing() makes it better.

I was surprised/confused to see this behavior:

$ cat foo.t
use Test::More tests => 14;
ok( 1 );
done_testing();


$ prove -v foo.t
[13:55:39] foo.t ..
1..14
ok 1
not ok 2 - planned to run 14 but done_testing() expects 1

#   Failed test 'planned to run 14 but done_testing() expects 1'
#   at /usr/lib/perl5/5.8.8/Test/More.pm line 220.
# Looks like you planned 14 tests but ran 2.
# Looks like you failed 1 test of 2 run.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 13/14 subtests
[13:55:39]

Test Summary Report
-------------------
foo.t (Wstat: 256 Tests: 2 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
  Parse errors: Bad plan.  You planned 14 tests but ran 2.
Files=1, Tests=2, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.02 cusr 0.01 csys = 0.07 CPU)
Result: FAIL


"Looks like you failed 1 test of 2 run". I guess that it's counting done_testing() as a test in itself, but that doesn't seem to be right. Is that intentional?

xoxo,
Andy


--
Andy Lester => a...@petdance.com => www.theworkinggeek.com => AIM:petdance




Reply via email to