On Jan 23, 2009, at 10:18 AM, Fergal Daly wrote:
> With nesting, you can move some aspects of the plan closer to the code
> (which is good) but you must always have some part of the plan far
> enough away from the code so that it is not subject to the same bugs.
> Ideally something like this would work
>
> plan(3);
>
> test1();
> test2();
> ok(1)
>
> sub test1 {
> plan(2);
> ok(1)
> ok(2);
> }
>
> sub test1 {
> plan(5);
> for $i (1..5) {
> ok($i)
> }
> }
>
> But that requires some magic to detect the end of the block so it
> would have to look a little different. It also requires nested TAP. In
> this example plan(x) means that the total number of tests and blocks
> of tests should sum to x.
Hey Fergal, check out Test::Block. It's not far from this and works
today.
Best,
David