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