I've just implemented the oft requested Test::Builder::Module.  Its a
superclass for all Test::Builder based modules that implements an import()
method to match what Test::More does and a builder() method to get the
Test::Builder object.

The upshot is that writing a test module is now reduced to this:

        package Test::Simple;

        # inherit import() and builder()
        use base qw(Test::Builder::Module);
        @EXPORT = qw(ok);

        # replaces $Test = Test::Builder->new;
        my $Test = Test::Simple->builder;

        sub ok ($;$) {
                $Test->ok(@_);
        }

        1;

That implements all of Test::Simple.  Means you no longer have to rely on
Test::More to set the plan, you can inherit the same logic.

builder() is like Test::More->builder.  It provides a way to get at a
testing module's underlying Test::Builder object.  Calling builder() is
safer than Test::Builder->new as it is forward compatible for a day when 
each module will be able to have its own Test::Builder object rather than 
the strict singleton it is now.

I've checked Test::Builder::Module into the repo, but its not documented
yet.  What I'm looking for is ideas about more things it could do that would
be useful for most testing libraries.  What scaffolding do module authors 
find themselves implementing?  import() and builder() is all I can think
of.


-- 
Michael G Schwern     [EMAIL PROTECTED]     http://www.pobox.com/~schwern
Just call me 'Moron Sugar'.
        http://www.somethingpositive.net/sp05182002.shtml

Reply via email to