|
Line 0
Link Here
|
| 0 |
- |
1 |
#!/usr/bin/env perl |
|
|
2 |
|
| 3 |
# This file is part of Koha. |
| 4 |
# |
| 5 |
# Koha is free software; you can redistribute it and/or modify it |
| 6 |
# under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# Koha is distributed in the hope that it will be useful, but |
| 11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 17 |
|
| 18 |
use Modern::Perl; |
| 19 |
use Test::More; |
| 20 |
use Test::NoWarnings; |
| 21 |
use Pod::Coverage; |
| 22 |
|
| 23 |
# Note that we are using Pod::Coverage instead of Test::Pod::Coverage |
| 24 |
# We do not want to fail if no pod exists in the file. |
| 25 |
# That could be a next step |
| 26 |
|
| 27 |
my @files; |
| 28 |
push @files, qx{git ls-files '*.pm'}; |
| 29 |
chomp for @files; |
| 30 |
|
| 31 |
plan tests => scalar(@files) + 1; |
| 32 |
|
| 33 |
for my $file (@files) { |
| 34 |
my @uncovered = check_pod_coverage($file); |
| 35 |
is( scalar(@uncovered), 0, "POD coverage for $file" ) or diag( join ", ", @uncovered ); |
| 36 |
|
| 37 |
} |
| 38 |
|
| 39 |
sub check_pod_coverage { |
| 40 |
my ($file) = @_; |
| 41 |
|
| 42 |
my $package_name = $file; |
| 43 |
$package_name =~ s|/|::|g; |
| 44 |
$package_name =~ s|\.pm$||; |
| 45 |
|
| 46 |
my $coverage = Pod::Coverage->new( package => $package_name ); |
| 47 |
return $coverage->uncovered; |
| 48 |
} |