pod-coverage.t 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/perl
  2. #
  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.
  7. #
  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.
  12. #
  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/>.
  15. use strict;
  16. use warnings;
  17. use File::Find;
  18. use Test::More;
  19. use Test::Dpkg qw(:needs);
  20. test_needs_author();
  21. test_needs_module('Test::Pod::Coverage');
  22. test_needs_srcdir_switch();
  23. sub all_pod_modules
  24. {
  25. my @modules;
  26. my $scan_perl_modules = sub {
  27. my $module = $File::Find::name;
  28. # Only chack modules, scripts are documented in man pages.
  29. return unless $module =~ s/\.pm$//;
  30. # As a first step just check public modules (version > 0.xx).
  31. return unless system('grep', '^our \$VERSION = \'[^0]\.', $File::Find::name) == 0;
  32. $module =~ s{^\Q$File::Find::topdir\E/}{};
  33. push @modules, $module =~ s{/}{::}gr;
  34. };
  35. my %options = (
  36. wanted => $scan_perl_modules,
  37. no_chdir => 1,
  38. );
  39. find(\%options, Test::Dpkg::test_get_perl_dirs());
  40. return @modules;
  41. }
  42. my @modules = all_pod_modules();
  43. plan tests => scalar @modules;
  44. for my $module (@modules) {
  45. pod_coverage_ok($module);
  46. }