Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Wednesday November 11, 2009
07:57 AM

Test::Kit Production Release

[ #39879 ]

Recently I got off my duff and finally made a production release of Test::Kit. Do you like Test::Most but it doesn't have the testing modules you want? Just use Test::Kit instead. For example, instead of this at the beginning of half of your test files:

use Test::More 'no_plan';
use Test::Exception;
use Test::XML;

Turn those into a test kit with this:

package My::Custom::Tests;

use Test::Kit qw(
  Test::Exception
  Test::XML
);

1;

And in your test programs:

use My::Custom::Tests 'no_plan'; # or whatever you pass to Test::More

Do you now allow JSON serialization but don't want to add Test::JSON to every test program? Just add it to your test kit:

package My::Custom::Tests;

use Test::Kit qw(
  Test::Exception
  Test::XML
  Test::JSON
);

1;

... and all of your test programs now have JSON tests functions.

It's a much nicer way of managing your test suites. Duplicating boilerplate is bad.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Is importing a bunch of functions one may never use. The unnecessary namespace pollution makes me cringe.

    • So what? Besides, you use Test::More already, right? I'm sure it exports plenty of functions you don't use. Plus, you can exclude functions you don't want.

      use Test::Kit
          'Test::Something' => {
              # or a scalar for just one
              exclude => [qw/ list of excluded functions/],
          },
          'Test::Something::Else' => {
              # takes a hashref
              rename => {
           

      • I didn't say I was rational about it. :]

        But even if T::M puts unused stuff, that's no excuse for piling in more.

        • But you don't have to pile in more. You can specifically exclude anything you don't need. That's not something you can do with just "use"ing the modules :)