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/

Reply via email to