class_of Util::apply_all_roles 2/2
[gitmo/Moose.git] / xt / 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'                  => ['make_immutable'],
18     'Moose::Meta::Attribute' => [ 'interpolate_class', 'throw_error' ],
19     'Moose::Meta::Class'     => [
20         qw( check_metaclass_compatibility
21             construct_instance
22             create_error
23             raise_error
24             )
25     ],
26     'Moose::Meta::Method'           => ['throw_error'],
27     'Moose::Meta::Method::Accessor' => [
28         qw( generate_accessor_method
29             generate_accessor_method_inline
30             generate_clearer_method
31             generate_predicate_method
32             generate_reader_method
33             generate_reader_method_inline
34             generate_writer_method
35             generate_writer_method_inline
36             )
37     ],
38     'Moose::Meta::Method::Constructor' => [
39         qw( attributes
40             initialize_body
41             meta_instance
42             new
43             options
44             )
45     ],
46     'Moose::Meta::Method::Destructor' => [ 'initialize_body', 'options' ],
47     'Moose::Meta::Role'               => [
48         qw( alias_method
49             get_method_modifier_list
50             reset_package_cache_flag
51             update_package_cache_flag
52             wrap_method_body
53             )
54     ],
55     'Moose::Meta::Role::Composite' => ['add_method'],
56     'Moose::Role'                  => [
57         qw( after
58             around
59             augment
60             before
61             extends
62             has
63             inner
64             make_immutable
65             override
66             super
67             with )
68     ],
69     'Moose::Meta::TypeCoercion' => ['compile_type_coercion'],
70     'Moose::Meta::TypeCoercion::Union' => ['compile_type_coercion'],
71     'Moose::Meta::TypeConstraint' => [ 'compile_type_constraint', 'union' ],
72     'Moose::Meta::TypeConstraint::Class' =>
73         [qw( equals is_a_type_of is_a_subtype_of )],
74     'Moose::Meta::TypeConstraint::Enum' =>
75         [qw( constraint equals )],
76     'Moose::Meta::TypeConstraint::Parameterizable' => ['.+'],
77     'Moose::Meta::TypeConstraint::Parameterized'   => ['.+'],
78     'Moose::Meta::TypeConstraint::Role' =>
79         [qw( equals is_a_type_of )],
80     'Moose::Meta::TypeConstraint::Union' => ['compile_type_constraint'],
81     'Moose::Util'                        => ['add_method_modifier'],
82     'Moose::Util::TypeConstraints'       => ['find_or_create_type_constraint'],
83 );
84
85 for my $module ( sort @modules ) {
86     my $trustme = [];
87     if ( $trustme{$module} ) {
88         my $methods = join '|', @{ $trustme{$module} };
89         $trustme = [qr/^(?:$methods)$/];
90     }
91
92     pod_coverage_ok(
93         $module, { trustme => $trustme },
94         "Pod coverage for $module"
95     );
96 }