Only run tests for maintainer
[gitmo/MooseX-ClassAttribute.git] / t / pod-coverage.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5
6 plan skip_all => 'This test is only run for the module author'
7     unless -d '.svn' || $ENV{IS_MAINTAINER};
8
9 eval "use Test::Pod::Coverage 1.04";
10 plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage"
11     if $@;
12
13 # This is a stripped down version of all_pod_coverage_ok which lets us
14 # vary the trustme parameter per module.
15 my @modules = all_modules();
16 plan tests => scalar @modules;
17
18 my %trustme =
19     ( 'MooseX::ClassAttribute'                         => [ 'init_meta', 'class_has' ],
20       'MooseX::ClassAttribute::Meta::Method::Accessor' => qr/.+/,
21     );
22
23 for my $module ( sort @modules )
24 {
25     my $trustme;
26
27     if ( $trustme{$module} )
28     {
29         # why is qr// not a ref?
30         if ( ! ref $trustme{module} )
31         {
32             $trustme = [ $trustme{module} ]
33         }
34         else
35         {
36             my $methods = join '|', @{ $trustme{$module} };
37             $trustme = [ qr/^(?:$methods)/ ];
38         }
39     }
40
41     pod_coverage_ok( $module, { trustme => $trustme },
42                      "Pod coverage for $module"
43                    );
44 }