in reply to How can I write Test::Finished?
The only reason not to, as far as I can divine, is the worry that your tests might stop part way through without producing a non-zero exit code.
It can also be a useful sanity check when you know the number of tests. For example they're useful when you accidentally cut and forget to paste, or when you have test runs where you have the number of tests determined at runtime and a dodgy piece of logic.
I do think the file is the wrong level of granularity though, which is why I tend to have them at the method level (via Test::Class) or block level (via Test::Block) if I do use them.
Overriding exit() sounds like the better choice. Sticking something at the end of the script could cause problems with test scripts the have multiple or non-obvious exit points. You'd have to be careful about thinks like Test::Builder's skip_all.
The only other things that I can think of that would exit cleanly would be POSIX::_exit or a piece of XS code. However AFAIK neither of those would run the Test::Builder END block so Test::Harness would pick up on the lack of a test footer.
That said I'd just not sweat it, use no_plan, and not worry.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How can I write Test::Finished?
by demerphq (Chancellor) on Jun 21, 2004 at 18:46 UTC |