Detect when Devel::Symdump pukes and skip modules that fail falsely.
Give better diagnostics so that true coverage can be monitored.
This commit is contained in:
parent
787697adce
commit
f47cb2ffdd
1 changed files with 11 additions and 6 deletions
17
t/POD.t
17
t/POD.t
|
|
@ -20,14 +20,23 @@ use File::Spec;
|
|||
|
||||
plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
|
||||
|
||||
my $threshold = $ENV{POD_COVERAGE} ? 0.75 : 0;
|
||||
|
||||
my @modules = ();
|
||||
find(\&countModules, File::Spec->catdir( WebGUI::Test->lib, 'WebGUI' ) );
|
||||
my $moduleCount = scalar(@modules);
|
||||
plan tests => $moduleCount;
|
||||
foreach my $package (sort @modules) {
|
||||
my $pc = Pod::Coverage->new(package=>$package);
|
||||
ok($pc->coverage, $package);
|
||||
my $pc = Pod::Coverage->new(
|
||||
package=>$package,
|
||||
also_private => [ qr/definition/ ],
|
||||
);
|
||||
my $coverage = $pc->coverage > $threshold;
|
||||
my $goodReason = $pc->why_unrated() eq 'no public symbols defined';
|
||||
SKIP: {
|
||||
skip "No subroutines found by Devel::Symdump for $package", 1 if $goodReason;
|
||||
ok($coverage, sprintf "%s has %d%% POD coverage", $package, $pc->coverage*100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -41,7 +50,3 @@ sub countModules {
|
|||
$package =~ s/\//::/g;
|
||||
push(@modules,$package);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue