AFS-PAG
view release on metacpan or search on metacpan
t/style/coverage.t view on Meta::CPAN
# Skip code coverage unless author tests are enabled since it takes a long
# time, is sensitive to versions of various libraries, and does not detect
# functionality problems.
skip_unless_author('Coverage tests');
# Load prerequisite modules.
use_prereq('Devel::Cover');
use_prereq('Test::Strict');
# Build a list of test directories to use for coverage.
my %ignore = map { $_ => 1 } qw(data docs style), @COVERAGE_SKIP_TESTS;
opendir(my $testdir, 't') or BAIL_OUT("cannot open t: $!");
my @t_dirs = readdir($testdir) or BAIL_OUT("cannot read t: $!");
closedir($testdir) or BAIL_OUT("cannot close t: $!");
# Filter out ignored and system directories.
@t_dirs = grep { !$ignore{$_} } File::Spec->no_upwards(@t_dirs);
# Prepend the t directory name to the directories.
@t_dirs = map { File::Spec->catfile('t', $_) } @t_dirs;
# Disable POD coverage; that's handled separately and is confused by
# autoloading.
$Test::Strict::DEVEL_COVER_OPTIONS
= '-coverage,statement,branch,condition,subroutine';
# Do the coverage analysis.
all_cover_ok($COVERAGE_LEVEL, @t_dirs);
# Hack to suppress "used only once" warnings.
t/style/critic.t view on Meta::CPAN
for my $dir (qw(examples usr t)) {
if (-d $dir) {
push(@files, Perl::Critic::Utils::all_perl_files($dir));
}
}
# Strip out Autoconf templates or left-over perltidy files.
@files = grep { !m{ [.](?:in|tdy) }xms } @files;
# Strip out ignored files.
my %ignore = map { $_ => 1 } @CRITIC_IGNORE;
@files = grep { !$ignore{$_} } @files;
# Declare a plan now that we know what we're testing.
plan tests => scalar @files;
# Run the actual tests.
for my $file (@files) {
critic_ok($file);
}
( run in 0.638 second using v1.01-cache-2.11-cpan-49f99fa48dc )