On Wednesday 20 August 2003 22:19, Michael G Schwern wrote: > That's subtests having overall test state. Ideally don't want the subtests > to have *any* awareness that they're being run as a subtest.
The state is held in the Test::Builder object just as currently, it's just that that object has to be a bit more complicated than before. Full nesting requires more state to be held and as it stands, doesn't help in your example below. It could be altered to support it though by adding support for standalone sub blocks, ie where the harness should temporarily forget all the results it's seen before and start counting from scratch until it reaches the end of the standalone sub block marker. So, your example with some extra stuff would look like is_valid_person($person); local $ENV{FOO} = 'bar'; system("$^X foo.t"); local $ENV{FOO} = ''; system("%^X foo.t"); { local $ENV{FOO}; delete $ENV{FOO}; system("$^X foo.t"); } is_valid_person($person2); and the output from your example could look like 1..5 # standalone plan 1..4 # checking person ok 1.1 ok 1.2 ok 1.3 ok 1.4 ok 1 # checking person plan ok # running with foo=bar 1..3 # standalone ok 1 ok 2 ok 3 fin # running with foo='' 1..3 ok 1 ok 2 ok 3 fin # running without foo 1..3 ok 1 ok 2 ok 3 fin plan 5..4 # checking person ok 5.1 ok 5.2 ok 5.3 ok 5.4 If the harness is smart enough it can correctly renumber the tests in the standalone blocks so that they match up, if not, it doesn't really matter. This handles all cases. It's more complicated of course but to do either nesting or extensions is complicated and to do both is a little more again, F