Ovid wrote:
> Also at http://use.perl.org/~Ovid/journal/32614
> 
> I get tired of writing this all the time:
> 
>   #!/usr/bin/perl
> 
>   use Test::More tests => 23;
>   use Test::Exception;
>   use Test::Differences;
>   use Test::NoWarnings;
> 
>   ...
> 
> I write that *a lot*.  No more.  This does the same thing:
> 
>   #!/usr/bin/perl
> 
>   use My::Test::More tests => 23;
> 
> And the code:
> 
>   package My::Test::More;
>   
>   use Test::Builder::Module;
>   @ISA = qw(Test::Builder::Module);
>   use Test::More;
>   use Test::Differences;
>   use Test::Exception;
> 
>   INIT {
>       unless ( exists $INC{'Test/Class.pm'} ) {
> 
>           # NoWarnings doesn't play well with Test::Class
>           eval "use Test::NoWarnings";
>       }
>   }
> 
>   @EXPORT = (
>       @Test::More::EXPORT,
>       @Test::Differences::EXPORT,
>       @Test::Exception::EXPORT,
>   );
> 
>   $ENV{RUNNING_TESTS} = 1;
> 
>   1;
> 
> Cheers,
> Ovid
> 
> --
> 
> Buy the book -- http://www.oreilly.com/catalog/perlhks/
> Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/
> 
> 

I think it was you or someone else who got me started on this in Handel
and my other DBIC based dists where I needed both Test::More and custom
sqlite t/var initializer junk:

http://search.cpan.org/src/CLACO/DBIx-Class-InflateColumn-Currency-0.01/t/lib/DBIC/Test.pm

Yup, in fact, your still in the comments... :-)

> BEGIN {
>     # little trick by Ovid to pretend to subclass+exporter Test::More
>     use base qw/Test::Builder::Module Class::Accessor::Grouped/;
>     use Test::More;
>     use File::Spec::Functions qw/catfile catdir/;
> 
>     @DBIC::Test::EXPORT = @Test::More::EXPORT;
> 
>     __PACKAGE__->mk_group_accessors('inherited', qw/db_dir db_file/);
> };


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to