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.
Is importing a bunch of functions one may never use. The unnecessary namespace pollution makes me cringe.
Re:My problem with Test::Most, et al..
Ovid on 2009-11-11T17:13:20
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 => {
old_test_function_name => 'new_test_function_name',
},
};This might look familiar.
Re:My problem with Test::Most, et al..
elliot on 2009-11-11T20:47:33
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.
Re:My problem with Test::Most, et al..
Ovid on 2009-11-11T21:19:04
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
:)