in reply to Seeking advice for portable test suite

all_critic_ok provides it's own plan, so by providing a plan before calling it, you plan twice in the situation where it works. Instead you should do something like this:

use Test::More; eval "use Test::Perl::Critic"; if ( $@ ) { plan skip_all => "because Test::Perl::Critic required for these te +sts"; } else { all_critic_ok(); }

Even if you get your code working, the skip isn't going to work correctly because you are only skipping 1 test, and all_critic_ok() is going to run 1 test for each file returned by all_perl_files().


We're not surrounded, we're in a target-rich environment!

Replies are listed 'Best First'.
Re^2: Seeking advice for portable test suite
by perrin (Chancellor) on Jan 13, 2007 at 17:20 UTC
    This is exactly how it should be done. I think people get confused by the magical "import is your plan" approach that Test::More provides and don't realize they can just call it separately from loading the module.