1#!/usr/bin/perl 2 3use warnings 'all'; 4use strict; 5 6BEGIN { 7 use Test::More; 8 # Don't run tests for installs 9 unless ($ENV{RELEASE_TESTING}) { 10 plan skip_all => 'Author tests not required for installation (set RELEASE_TESTING to test)'; 11 } 12} 13 14# CPANTORPM-DEPREQ REQEXCL File::Basename 15# CPANTORPM-DEPREQ REQEXCL Cwd 16# CPANTORPM-DEPREQ REQEXCL Test::Pod::Coverage 17 18use File::Basename; 19use Cwd 'abs_path'; 20use Test::Pod::Coverage 1.00; 21 22# Figure out the directories. This comes from Test::Inter. 23 24my($moddir,$testdir,$libdir); 25 26BEGIN { 27 if (-f "$0") { 28 $moddir = dirname(dirname(abs_path($0))); 29 } elsif (-d "./t") { 30 $moddir = dirname(abs_path('.')); 31 } elsif (-d "../t") { 32 $moddir = dirname(abs_path('..')); 33 } 34 if (-d "$moddir/t") { 35 $testdir = "$moddir/t"; 36 } 37 if (-d "$moddir/lib") { 38 $libdir = "$moddir/lib"; 39 } 40} 41use lib $libdir; 42 43# If there is a file _pod_coverage.ign, it should be a list of module 44# name substrings to ignore (any module with any of these substrings 45# will be ignored). 46 47my @ign = (); 48if (-f "$testdir/_pod_coverage.ign") { 49 open(IN,"$testdir/_pod_coverage.ign"); 50 @ign = <IN>; 51 close(IN); 52 chomp(@ign); 53} 54 55# 56# Test that the POD documentation is complete. 57# 58 59chdir($moddir); 60 61if (@ign) { 62 63 my @mod = all_modules('lib'); 64 my @test = (); 65 66 MOD: 67 foreach my $mod (@mod) { 68 foreach my $ign (@ign) { 69 next MOD if ($mod =~ /\Q$ign\E/); 70 } 71 push(@test,$mod); 72 } 73 74 chdir($libdir); 75 plan tests => scalar(@test); 76 foreach my $mod (@test) { 77 pod_coverage_ok($mod); 78 } 79 80} else { 81 all_pod_coverage_ok(); 82} 83