Merged topic/metarole-distinguishes-role-meta (which includes topic/roles-have-real...
[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::Code'    => ['.+'],
26     'Moose::Meta::Attribute::Native::MethodProvider::Counter' => ['.+'],
27     'Moose::Meta::Attribute::Native::MethodProvider::Hash'    => ['.+'],
28     'Moose::Meta::Attribute::Native::MethodProvider::String'  => ['.+'],
29     'Moose::Meta::Class'                                      => [
30         qw( check_metaclass_compatibility
31             construct_instance
32             create_error
33             raise_error
34             reinitialize
35             superclasses
36             )
37     ],
38     'Moose::Meta::Class::Immutable::Trait' => ['.+'],
39     'Moose::Meta::Method'                  => ['throw_error'],
40     'Moose::Meta::Method::Accessor'        => [
41         qw( generate_accessor_method
42             generate_accessor_method_inline
43             generate_clearer_method
44             generate_predicate_method
45             generate_reader_method
46             generate_reader_method_inline
47             generate_writer_method
48             generate_writer_method_inline
49             )
50     ],
51     'Moose::Meta::Method::Constructor' => [
52         qw( attributes
53             initialize_body
54             meta_instance
55             new
56             options
57             )
58     ],
59     'Moose::Meta::Method::Destructor' => [ 'initialize_body', 'options' ],
60     'Moose::Meta::Role'               => [
61         qw( alias_method
62             get_method_modifier_list
63             reinitialize
64             reset_package_cache_flag
65             update_package_cache_flag
66             wrap_method_body
67             )
68     ],
69     'Moose::Meta::Mixin::AttributeCore' => ['.+'],
70     'Moose::Meta::Role::Composite' =>
71         [ 'get_method', 'get_method_list', 'has_method', 'add_method' ],
72     'Moose::Role' => [
73         qw( after
74             around
75             augment
76             before
77             extends
78             has
79             inner
80             override
81             super
82             with )
83     ],
84     'Moose::Meta::TypeCoercion'        => ['compile_type_coercion'],
85     'Moose::Meta::TypeCoercion::Union' => ['compile_type_coercion'],
86     'Moose::Meta::TypeConstraint'      => ['compile_type_constraint'],
87     'Moose::Meta::TypeConstraint::Class' =>
88         [qw( equals is_a_type_of is_a_subtype_of )],
89     'Moose::Meta::TypeConstraint::Enum' => [qw( constraint equals )],
90     'Moose::Meta::TypeConstraint::DuckType' =>
91         [qw( constraint equals get_message )],
92     'Moose::Meta::TypeConstraint::Parameterizable' => ['.+'],
93     'Moose::Meta::TypeConstraint::Parameterized'   => ['.+'],
94     'Moose::Meta::TypeConstraint::Role'  => [qw( equals is_a_type_of )],
95     'Moose::Meta::TypeConstraint::Union' => ['compile_type_constraint'],
96     'Moose::Util'                        => ['add_method_modifier'],
97     'Moose::Util::MetaRole'              => ['apply_metaclass_roles'],
98     'Moose::Util::TypeConstraints' => ['find_or_create_type_constraint'],
99 );
100
101 for my $module ( sort @modules ) {
102     my $trustme = [];
103     if ( $trustme{$module} ) {
104         my $methods = join '|', @{ $trustme{$module} };
105         $trustme = [qr/^(?:$methods)$/];
106     }
107
108     pod_coverage_ok(
109         $module, { trustme => $trustme },
110         "Pod coverage for $module"
111     );
112 }