hide has been programming in Perl since 1998. Much of this time has been focused on system automation and data warehousing.
On CPAN as: SSORICHE [cpan.org]
When writing tests for my modules, my usual method is to create a separate
I tend to put Carp to good use. croak can be found throughout the modules I write wherever a method requires something (write access to a file, parameters passed, etc). To test that each croak works the way I expect I use Test::Exception's dies_ok.
In each
SKIP: {
eval { use Test::Exception };
skip 'Test::Exception not installed', 1 if $@;
dies_ok { test code here }, 'message';
}
Test::Exception is installed on all of my development boxes, and all of our production boxes to ensure full testing before a module gets installed. This caused me not to realize that the above code does not work if you don't have Test::Exception installed. Something I did not notice until I released CPAN::Mini::Inject onto CPAN.
One of the cpantesters and rjbs brought this to my attention on the Windows platform. I'd thought I'd fixed it with the last release, until today.
I spent today installing Perl and configuring remote access on one of the kids Windows XP systems (my plan is to use it to test my code and to as a cpantester). First thing, install CPANPLUS, second try to install CPAN::Mini::Inject. Failures all over the place. Can not find Test::Exception.
I ended up moving all of the exception tests out of each method's
use Test::More;
BEGIN {
eval "use Test::Exception";
plan skip_all => "Test Exceptions required to test croaks" if $@;
plan tests => 9; # # of tests.
}
Now the tests all pass on boxes with or without Test::Exception installed. Needless to say expect CPAN::Mini::Inject 0.16 shortly.
Include Test::Exception? (Score:1)
broquaint out
Re:Include Test::Exception? (Score:2)