| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
use warnings 'all'; |
| 4 |
use strict; |
| 5 |
|
| 6 |
BEGIN { |
| 7 |
use Test::More; |
| 8 |
# Don't run tests for installs |
| 9 |
unless ($ENV{Date_Manip_RELEASE_TESTING}) { |
| 10 |
plan skip_all => 'Author tests not required for installation (set Date_Manip_RELEASE_TESTING to test)'; |
| 11 |
} |
| 12 |
} |
| 13 |
|
| 14 |
# CPANTORPM-DEPREQ REQEXCL File::Basename |
| 15 |
# CPANTORPM-DEPREQ REQEXCL Cwd |
| 16 |
# CPANTORPM-DEPREQ REQEXCL Test::Pod |
| 17 |
|
| 18 |
use File::Basename; |
| 19 |
use Cwd 'abs_path'; |
| 20 |
use Test::Pod 1.00; |
| 21 |
|
| 22 |
# Figure out the directories. This comes from Test::Inter. |
| 23 |
|
| 24 |
my($moddir,$testdir,$libdir); |
| 25 |
|
| 26 |
BEGIN { |
| 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 |
} |
| 41 |
|
| 42 |
# If there is a file _pod.ign, it should be a list of filename |
| 43 |
# substrings to ignore (any file with any of these substrings |
| 44 |
# will be ignored). |
| 45 |
# |
| 46 |
# If there is a file named _pod.dirs, then pod files will be looked |
| 47 |
# at in those directories (instead of the default of all directories). |
| 48 |
|
| 49 |
my @ign = (); |
| 50 |
if (-f "$testdir/_pod.ign") { |
| 51 |
open(IN,"$testdir/_pod.ign"); |
| 52 |
@ign = <IN>; |
| 53 |
close(IN); |
| 54 |
chomp(@ign); |
| 55 |
} |
| 56 |
|
| 57 |
my @dirs = (); |
| 58 |
if (-f "$testdir/_pod.dirs") { |
| 59 |
open(IN,"$testdir/_pod.dirs"); |
| 60 |
@dirs = <IN>; |
| 61 |
close(IN); |
| 62 |
chomp(@dirs); |
| 63 |
} |
| 64 |
|
| 65 |
# |
| 66 |
# Test that the syntax of our POD documentation is valid. |
| 67 |
# |
| 68 |
|
| 69 |
chdir($moddir); |
| 70 |
|
| 71 |
if (@ign) { |
| 72 |
|
| 73 |
my @file = all_pod_files(@dirs); |
| 74 |
my @test; |
| 75 |
|
| 76 |
FILE: |
| 77 |
foreach my $file (@file) { |
| 78 |
foreach my $ign (@ign) { |
| 79 |
next FILE if ($file =~ /\Q$ign\E/); |
| 80 |
} |
| 81 |
push(@test,$file); |
| 82 |
} |
| 83 |
|
| 84 |
plan tests => scalar(@test); |
| 85 |
foreach my $file (@test) { |
| 86 |
pod_file_ok($file); |
| 87 |
} |
| 88 |
|
| 89 |
} else { |
| 90 |
all_pod_files_ok(@dirs); |
| 91 |
} |