David E. Wheeler wrote:
> On Feb 5, 2009, at 12:34 PM, Michael G Schwern wrote:
>
>> 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?
>
> All makes pretty good sense to me.
How should that plan violation be expressed? Making a passing test fail is
wrong, because the test didn't fail, it's a plan violation. I can make the
plan addition itself a test, but only if it fails.
So this...
use Test::More;
plan add => 2;
pass("First test");
plan add => 1;
pass("Second test");
pass("Third test");
Might produce:
# Planning 2 more tests at foo.t line 3.
ok 1 - First test
not ok 2 - 2 tests were planned but only 1 was run
# Failed test "2 tests were planned but only 1 was run"
# at foo.t line 6.
# Planning 1 more test at foo.t line 6.
ok 3 - Second test
ok 4 - Third test
1..3
Or would that be 1..4? Having an overall plan violation on top of the plan
addition failure seems a bit much, because the number of tests run was correct
(until we added one of our own).
--
170. Not allowed to "defect" to OPFOR during training missions.
-- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army
http://skippyslist.com/list/