5335eef3381f9fe5bc22864049a5d96ceef362ae
[dbsrgits/SQL-Abstract.git] / t / 91podcoverage.t
1 use Test::More;
2
3 # TEMPORARY
4 if (my $head = `git rev-parse HEAD`) {
5   plan skip_all => "Test disabled until after merge"
6     if $head ne `git rev-parse master`;
7
8   die "\n\n=================\n!!! Fix the test and remove temporary header !!!\n=================\n\n";
9 }
10
11 eval "use Pod::Coverage 0.19";
12 plan skip_all => 'Pod::Coverage 0.19 required' if $@;
13 eval "use Test::Pod::Coverage 1.04";
14 plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
15
16 plan skip_all => 'set TEST_POD to enable this test'
17   unless ( $ENV{TEST_POD} || -e 'MANIFEST.SKIP' );
18
19 my @modules = sort { $a cmp $b } ( Test::Pod::Coverage::all_modules() );
20
21 # Since this is about checking documentation, a little documentation
22 # of what this is doing might be in order...
23 # The exceptions structure below is a hash keyed by the module
24 # name.  The value for each is a hash, which contains one or more
25 # (although currently more than one makes no sense) of the following
26 # things:-
27 #   skip   => a true value means this module is not checked
28 #   ignore => array ref containing list of methods which
29 #             do not need to be documented.
30 my $exceptions = {
31     'SQL::Abstract' => {
32         ignore => [
33             qw/belch
34               puke/
35         ]
36     },
37     'SQL::Abstract::Test' => { skip => 1 },
38     'DBIx::Class::Storage::Debug::PrettyPrint' => { skip => 1 },
39 };
40
41 foreach my $module (@modules) {
42   SKIP:
43     {
44         skip "$module - No user visible methods",
45           1
46           if ( $exceptions->{$module}{skip} );
47
48         # build parms up from ignore list
49         my $parms = {};
50         $parms->{trustme} =
51           [ map { qr/^$_$/ } @{ $exceptions->{$module}{ignore} } ]
52           if exists( $exceptions->{$module}{ignore} );
53
54         # run the test with the potentially modified parm set
55         pod_coverage_ok( $module, $parms, "$module POD coverage" );
56     }
57 }
58
59 done_testing;