pod coverage and such
[gitmo/Moose.git] / xt / release / pod-coverage.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7
8 use Test::Requires {
9     'Test::Pod::Coverage' => '1.04',    # skip all if not installed
10 };
11
12 # This is a stripped down version of all_pod_coverage_ok which lets us
13 # vary the trustme parameter per module.
14 my @modules
15     = grep { !/Accessor::Native.*$/ && !/::Conflicts$/ } all_modules();
16 plan tests => scalar @modules;
17
18 my %trustme = (
19     'Class::MOP' => [
20         'DEBUG_NO_META',
21         'HAVE_ISAREV',
22         'IS_RUNNING_ON_5_10',
23         'subname',
24         'in_global_destruction',
25         'check_package_cache_flag',
26         'load_first_existing_class',
27     ],
28     'Class::MOP::Attribute' => ['process_accessors'],
29     'Class::MOP::Class'     => [
30         # deprecated
31         'alias_method',
32         'compute_all_applicable_attributes',
33         'compute_all_applicable_methods',
34
35         # unfinished feature
36         'add_dependent_meta_instance',
37         'add_meta_instance_dependencies',
38         'invalidate_meta_instance',
39         'invalidate_meta_instances',
40         'remove_dependent_meta_instance',
41         'remove_meta_instance_dependencies',
42         'update_meta_instance_dependencies',
43
44         # effectively internal
45         'check_metaclass_compatibility',
46         'clone_instance',
47         'construct_class_instance',
48         'construct_instance',
49         'create_meta_instance',
50         'reset_package_cache_flag',
51         'update_package_cache_flag',
52         'reinitialize',
53
54         # doc'd with rebless_instance
55         'rebless_instance_away',
56
57         # deprecated
58         'get_attribute_map',
59     ],
60     'Class::MOP::Class::Immutable::Trait'             => ['.+'],
61     'Class::MOP::Class::Immutable::Class::MOP::Class' => ['.+'],
62     'Class::MOP::Deprecated'                          => ['.+'],
63     'Class::MOP::Instance'                            => [
64         qw( BUILDARGS
65             bless_instance_structure
66             is_dependent_on_superclasses ),
67     ],
68     'Class::MOP::Instance' => [
69         qw( BUILDARGS
70             bless_instance_structure
71             is_dependent_on_superclasses ),
72     ],
73     'Class::MOP::Method::Accessor' => [
74         qw( generate_accessor_method
75             generate_accessor_method_inline
76             generate_clearer_method
77             generate_clearer_method_inline
78             generate_predicate_method
79             generate_predicate_method_inline
80             generate_reader_method
81             generate_reader_method_inline
82             generate_writer_method
83             generate_writer_method_inline
84             initialize_body
85             )
86     ],
87     'Class::MOP::Method::Constructor' => [
88         qw( attributes
89             generate_constructor_method
90             generate_constructor_method_inline
91             initialize_body
92             meta_instance
93             options
94             )
95     ],
96     'Class::MOP::Method::Generated' => [
97         qw( new
98             definition_context
99             is_inline
100             initialize_body
101             )
102     ],
103     'Class::MOP::MiniTrait'            => ['.+'],
104     'Class::MOP::Mixin::AttributeCore' => ['.+'],
105     'Class::MOP::Mixin::HasAttributes' => ['.+'],
106     'Class::MOP::Mixin::HasMethods'    => ['.+'],
107     'Class::MOP::Package'    => [ 'get_method_map', 'wrap_method_body' ],
108     'Moose' => ['init_meta', 'throw_error'],
109     'Moose::Error::Confess'  => ['new'],
110     'Moose::Error::Util' => ['.+'],
111     'Moose::Meta::Attribute' => [
112         qw( interpolate_class
113             throw_error
114             attach_to_class
115             )
116     ],
117     'Moose::Meta::Attribute::Native::MethodProvider::Array'   => ['.+'],
118     'Moose::Meta::Attribute::Native::MethodProvider::Bool'    => ['.+'],
119     'Moose::Meta::Attribute::Native::MethodProvider::Code'    => ['.+'],
120     'Moose::Meta::Attribute::Native::MethodProvider::Counter' => ['.+'],
121     'Moose::Meta::Attribute::Native::MethodProvider::Hash'    => ['.+'],
122     'Moose::Meta::Attribute::Native::MethodProvider::String'  => ['.+'],
123     'Moose::Meta::Class'                                      => [
124         qw( check_metaclass_compatibility
125             construct_instance
126             create_error
127             raise_error
128             reinitialize
129             superclasses
130             )
131     ],
132     'Moose::Meta::Class::Immutable::Trait' => ['.+'],
133     'Moose::Meta::Method'                  => ['throw_error'],
134     'Moose::Meta::Method::Accessor'        => [
135         qw( generate_accessor_method
136             generate_accessor_method_inline
137             generate_clearer_method
138             generate_predicate_method
139             generate_reader_method
140             generate_reader_method_inline
141             generate_writer_method
142             generate_writer_method_inline
143             new
144             )
145     ],
146     'Moose::Meta::Method::Constructor' => [
147         qw( attributes
148             initialize_body
149             meta_instance
150             new
151             options
152             )
153     ],
154     'Moose::Meta::Method::Destructor' => [ 'initialize_body', 'options' ],
155     'Moose::Meta::Method::Meta'       => ['wrap'],
156     'Moose::Meta::Role'               => [
157         qw( alias_method
158             get_method_modifier_list
159             reinitialize
160             reset_package_cache_flag
161             update_package_cache_flag
162             wrap_method_body
163             )
164     ],
165     'Moose::Meta::Mixin::AttributeCore' => ['.+'],
166     'Moose::Meta::Role::Composite' =>
167         [ 'get_method', 'get_method_list', 'has_method', 'add_method' ],
168     'Moose::Object' => ['BUILDALL', 'DEMOLISHALL'],
169     'Moose::Role' => [
170         qw( after
171             around
172             augment
173             before
174             extends
175             has
176             inner
177             override
178             super
179             with
180             init_meta )
181     ],
182     'Moose::Meta::TypeCoercion'        => ['compile_type_coercion'],
183     'Moose::Meta::TypeCoercion::Union' => ['compile_type_coercion'],
184     'Moose::Meta::TypeConstraint' => [qw( compile_type_constraint inlined )],
185     'Moose::Meta::TypeConstraint::Class' =>
186         [qw( equals is_a_type_of is_a_subtype_of )],
187     'Moose::Meta::TypeConstraint::Enum' => [qw( constraint equals )],
188     'Moose::Meta::TypeConstraint::DuckType' =>
189         [qw( constraint equals get_message )],
190     'Moose::Meta::TypeConstraint::Parameterizable' => ['.+'],
191     'Moose::Meta::TypeConstraint::Parameterized'   => ['.+'],
192     'Moose::Meta::TypeConstraint::Role' => [qw( equals is_a_type_of )],
193     'Moose::Meta::TypeConstraint::Union' => [
194         qw( compile_type_constraint
195             coercion
196             has_coercion
197             can_be_inlined
198             inline_environment )
199     ],
200     'Moose::Util'                  => ['add_method_modifier'],
201     'Moose::Util::MetaRole'        => ['apply_metaclass_roles'],
202     'Moose::Util::TypeConstraints' => ['find_or_create_type_constraint'],
203     'Moose::Util::TypeConstraints::Builtins' => ['.+'],
204 );
205
206 for my $module ( sort @modules ) {
207
208     my $trustme = [];
209     if ( $trustme{$module} ) {
210         my $methods = join '|', @{ $trustme{$module} };
211         $trustme = [qr/^(?:$methods)$/];
212     }
213
214     pod_coverage_ok(
215         $module, { trustme => $trustme },
216         "Pod coverage for $module"
217     );
218 }