On Sep 25, 2006, at 8:16 PM, Christopher H. Laco wrote:

Now, for part 2. :-)
What's the sanest way to test t/*.t files without also testing
everything in t/lib ?

If I'm already using all_critic_ok(), I can't just call critic_ok() on
all the t/*.t files because a plan has already been set.

Would it be possible to have all_critic_ok also take globs:

all_critic_ok('blib', 't/*.t')

-=Chris

Here's what I would do:


use Test::More;
use Test::Perl::Critic qw(critic_ok);
use File::Slurp qw(read_dir);
use Perl::Critic::Utils qw(all_perl_files);

my @files = all_perl_files('blib'), grep {m/\.t\z/} read_dir('t');
plan tests => scalar @files;
for my $file (@files) {
   critic_ok( $file, $file );
}


Of course, you could easily replace that use of File::Slurp with opendir,readdir,closedir.

Chris

--
Chris Dolan, Software Developer, http://www.chrisdolan.net/
Public key: http://www.chrisdolan.net/public.key
vCard: http://www.chrisdolan.net/ChrisDolan.vcf



Reply via email to