dpkg-shlibdeps: Switch from exec() to Dpkg::IPC::spawn()
[dpkg.git] / t / pod-coverage.t
blob113feb2646fd1fbcc50a327ba68882de273c1c47
1 #!/usr/bin/perl
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 use strict;
17 use warnings;
19 use List::Util qw(any);
20 use File::Find;
21 use Module::Metadata;
23 use Test::More;
24 use Test::Dpkg qw(:needs);
26 test_needs_author();
27 test_needs_module('Test::Pod::Coverage');
28 test_needs_srcdir_switch();
30 sub all_pod_modules
32 my @modules_todo = @_;
33 my @modules;
34 my $scan_perl_modules = sub {
35 my $module = $File::Find::name;
37 # Only check modules, scripts are documented in man pages.
38 return unless $module =~ s/\.pm$//;
40 my $mod = Module::Metadata->new_from_file($File::Find::name);
42 # As a first step just check public modules (version > 0.xx).
43 return if $mod->version() =~ m/^0\.\d\d$/;
45 $module =~ s{^\Q$File::Find::topdir\E/}{};
46 $module =~ s{/}{::}g;
48 return if any { $module eq $_ } @modules_todo;
50 push @modules, $module;
53 my %options = (
54 wanted => $scan_perl_modules,
55 no_chdir => 1,
57 find(\%options, Test::Dpkg::test_get_perl_dirs());
59 return @modules;
62 my @modules_todo = qw(Dpkg::Arch Dpkg::Source::Package);
63 my @modules = all_pod_modules(@modules_todo);
65 plan tests => scalar @modules + scalar @modules_todo;
67 for my $module (@modules) {
68 pod_coverage_ok($module);
71 TODO: {
72 local $TODO = 'modules partially documented';
74 for my $module (@modules_todo) {
75 pod_coverage_ok($module);