Merge branch 'attribute_helpers'
[gitmo/Moose.git] / xt / author / pod_coverage.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7
8 eval "use Test::Pod::Coverage 1.04";
9 plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
10
11 # This is a stripped down version of all_pod_coverage_ok which lets us
12 # vary the trustme parameter per module.
13 my @modules = all_modules();
14 plan tests => scalar @modules;
15
16 my %trustme = (
17     'Moose::Meta::Attribute' => [
18         qw( interpolate_class
19             throw_error
20             attach_to_class
21             )
22     ],
23     'Moose::Meta::Attribute::Native::MethodProvider::Array'   => ['.+'],
24     'Moose::Meta::Attribute::Native::MethodProvider::Bool'    => ['.+'],
25     'Moose::Meta::Attribute::Native::MethodProvider::Counter' => ['.+'],
26     'Moose::Meta::Attribute::Native::MethodProvider::Hash'    => ['.+'],
27     'Moose::Meta::Attribute::Native::MethodProvider::String'  => ['.+'],
28     'Moose::Meta::Class'     => [
29         qw( check_metaclass_compatibility
30             construct_instance
31             create_error
32             raise_error
33             superclasses
34             )
35     ],
36     'Moose::Meta::Class::Immutable::Trait' => ['.+'],
37     'Moose::Meta::Method'                  => ['throw_error'],
38     'Moose::Meta::Method::Accessor'        => [
39         qw( generate_accessor_method
40             generate_accessor_method_inline
41             generate_clearer_method
42             generate_predicate_method
43             generate_reader_method
44             generate_reader_method_inline
45             generate_writer_method
46             generate_writer_method_inline
47             )
48     ],
49     'Moose::Meta::Method::Constructor' => [
50         qw( attributes
51             initialize_body
52             meta_instance
53             new
54             options
55             )
56     ],
57     'Moose::Meta::Method::Destructor' => [ 'initialize_body', 'options' ],
58     'Moose::Meta::Role'               => [
59         qw( alias_method
60             get_method_modifier_list
61             reset_package_cache_flag
62             update_package_cache_flag
63             wrap_method_body
64             )
65     ],
66     'Moose::Meta::Role::Composite' => ['add_method'],
67     'Moose::Role'                  => [
68         qw( after
69             around
70             augment
71             before
72             extends
73             has
74             inner
75             override
76             super
77             with )
78     ],
79     'Moose::Meta::TypeCoercion'        => ['compile_type_coercion'],
80     'Moose::Meta::TypeCoercion::Union' => ['compile_type_coercion'],
81     'Moose::Meta::TypeConstraint'      => ['compile_type_constraint'],
82     'Moose::Meta::TypeConstraint::Class' =>
83         [qw( equals is_a_type_of is_a_subtype_of )],
84     'Moose::Meta::TypeConstraint::Enum' => [qw( constraint equals )],
85     'Moose::Meta::TypeConstraint::DuckType' => [qw( constraint equals get_message )],
86     'Moose::Meta::TypeConstraint::Parameterizable' => ['.+'],
87     'Moose::Meta::TypeConstraint::Parameterized'   => ['.+'],
88     'Moose::Meta::TypeConstraint::Role'  => [qw( equals is_a_type_of )],
89     'Moose::Meta::TypeConstraint::Union' => ['compile_type_constraint'],
90     'Moose::Util'                        => ['add_method_modifier'],
91     'Moose::Util::TypeConstraints' => ['find_or_create_type_constraint'],
92 );
93
94 for my $module ( sort @modules ) {
95     my $trustme = [];
96     if ( $trustme{$module} ) {
97         my $methods = join '|', @{ $trustme{$module} };
98         $trustme = [qr/^(?:$methods)$/];
99     }
100
101     pod_coverage_ok(
102         $module, { trustme => $trustme },
103         "Pod coverage for $module"
104     );
105 }