On Wednesday 20 August 2003 08:23, Michael G Schwern wrote:
> You don't want subtests to have to know any state, such as how far to
> indent. Why?  Consider:

Something has to keep state, I was assuming it would be the block. Anyway, the 
indentation thing is bad because it won't work for threaded tests and 
aspect-oriented tests.

In my mind a block is just another Test::Builder object that behaves a little 
differently at destroy time and adds a prefix to it's test numbers.

Later on, I suggested instead something like

plan 1..3
plan .1 1..5
ok .1.1
ok .1.2
ok .1.3
plan .1.4 1..2
ok .1.4.1
ok .1.4.2
ok 1.4 # plan for .1.4 was ok
ok .1.5
ok .1 # plan for .1 was OK
ok .2
ok .3
1..8

A plan counts the number of tests and sub-blocks to expect. The 1..8 at the 
end would be calculated by summing the plans of all blocks.

This doesn't upset the current Test::Harness because the numbers begin with 
".".

It catches the "block 1 had 1 extra and block 2 had 1 less" problem because 
each sub block's plan is a test also.

It can handle threaded and aspect-oriented tests no problem, you just allocate 
block 1 to your aspect tests with no plan and they won't interfere with the 
rest of the proceedings. Similarly, just give each thread it's own block and 
away we go. Test numbers would now only be partially ordered so

1 < 2
1.1 < 1.2
2.1 < 2.2

but 1.2 and 2.2 are incomparable.

> I don't think we can get away with T::H not being modified.

If you want it to understand blocks and be able to say block 1.2.3.4 missed 1 
test and failed 2 then it will need to be modified.

F

Reply via email to