On Tue, Mar 08, 2005 at 12:50:29PM -0800, chromatic wrote: > On Tue, 2005-03-08 at 20:40 +0000, Fergal Daly wrote: > > > By singleton do you mean that there's only ever 1 Test::Builder::Counter and > > it's shared between all the Test::Builder objects? > > By default there's only one. You can create others, if necessary. > > > One way to allow this is to have a singleton Test::Builder and multiple > > Test::Builder::Run objects and Test::Builder can decide which > > Test::Builder::Run object is "live". This effectively what Test::Tester > > does. > > That's what I have in mind.
Cool, so actually T::B::Counter and T::B::Run are not singletons and Test::Builder is. > > That will lose the default level management. But I don't really understand > > the default level thing. The level has to be cumulative across test modules, > > incrementing for each subroutine call. What does it mean for Test::D to have > > a default level of 2? And what happens if Test::C::do_multiple_tests() calls > > into Test::D? > > The level is the number of entries in the call stack that a test module > puts between where users use the test function and where Test::Builder > receives the results. It tells Test::Builder how many frames to discard > when reporting failure files and lines. I know what it is, I just don't understand what it means for a module to have a default level. So: 1 - What does it means for Test::D to have a default level of 2? Does it mean that all calls on the T::B object have to originate from exactly 2 levels of calls into Test::D? If so, what can I do if some are from depth 3 or 1? 2 - What happens if Test::C::do_multiple_tests() calls Test::D::some_test()? The correct level is now Test::C's default level + Test::D's default level - 1 (or + 1 depending on the exact definition of level). Unless less Test::C is testing Test::D in which case... also Test::Builder may not even know how to find out what Test::C's default level is (it can't necessarily see Test::C's Test::Builder object and in fact Test::C may have created more than 1). F