I explain some of the background in http://use.perl.org/~Ovid/journal/39074,
but basically, I'm just giving folks a heads-up that running tests in
BEGIN/END/CHECK/INIT blocks may sometimes be problematic in the future.
Schwern is planning on pulling in the nested TAP branch to the Test::More
repository and that may cause issues like this:
use Test::More tests => 3;
ok $foo;
subtest 'some name' => sub {
load_and_run_some_other_tests();
};
ok $bar;
If load_and_run_some_other_tests() loads another file with tests run in
BEGIN/CHECK/INIT/END blocks, the subtests may have tests running out of
sequence, thus breaking the TAP stream. For example, the the loaded test
program has a test run in an END block, it will execute after the "ok $bar"
test.
This won't impact most tests, but it's something to be aware of and I expect
that it will be frustrating for some (Test::Aggregate is particularly prone to
this problem). However, the wins we gain with nested TAP should far outweigh
the negatives, though I anticipate much wailing and gnashing of teeth :)
Schwern, if you're concerned about this and think it merits warning under some
circumstances, you might want to check out Test::Aggregate::Builder's override
of Test::Builder::ok to see how I handle this issue.
Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://use.perl.org/~Ovid/journal/
Twitter - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6