By singleton do you mean that there's only ever 1 Test::Builder::Counter and
it's shared between all the Test::Builder objects? That's necessary in order
to maintain consitent numbering of tests but it doesn't allow for a
second counter to be established to temporarily count subtests (for example
when testing a test module).

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 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?

F

On Tue, Mar 08, 2005 at 11:24:59AM -0800, chromatic wrote:
> Hm, not anywhere close.  I think they were on your laptop, the one you
> took apart at the last TPC in San Diego.
> 
> I've been writing notes for Test::Builder for Perl 6, though.  It's a
> little something like:
> 
> Test::Builder - the primary interface.  Not a singleton anymore.  Test
> modules create new instances and tell it the default level.  This
> removes a global variable.
> 
> Test::Builder::Output - a singleton contained within Test::Builder.
> This holds the output filehandles.
> 
> Test::Builder::TestRun - a singleton contained within Test::Builder.
> This holds the plan, the counter, and the test details.
> 
> Test::Builder::Counter - a singleton contained within
> Test::Builder::TestRun.  This counts the tests.
> 
> Test::Builder::TestResults - the parent class for all types of tests
> (pass, fail, todo, skip).  This may be too much detail here, but I like
> the idea of these knowing how to format themselves for output.
> 
> By default, everything looks the same to using modules, except that the
> level trickery can go away, mostly.  It should be easy to swap out
> TestRun and Counter and TestResults within the current Test::Builder
> object temporarily, in the case of wanting to run a lot of subtests
> without increasing the number, for example.
> 
> Just some ideas,
> -- c

Reply via email to