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:
Colin Kuskie 2009-01-27 02:22:08 +00:00
parent 787697adce
commit f47cb2ffdd

17
t/POD.t
View file

@ -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);
}