9f29d535a70567c44992c875b2a90b74b0038d9c
[gitmo/Class-MOP.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     'Class::MOP'            => ['HAVE_ISAREV'],
18     'Class::MOP::Attribute' => ['process_accessors'],
19     'Class::MOP::Class'     => [
20
21         # deprecated
22         'alias_method',
23         'compute_all_applicable_attributes',
24         'compute_all_applicable_methods',
25
26         # unfinished feature
27         'add_dependent_meta_instance',
28         'add_meta_instance_dependencies',
29         'invalidate_meta_instance',
30         'invalidate_meta_instances',
31         'remove_dependent_meta_instance',
32         'remove_meta_instance_dependencies',
33         'update_meta_instance_dependencies',
34
35         # effectively internal
36         'check_metaclass_compatibility',
37         'clone_instance',
38         'construct_class_instance',
39         'construct_instance',
40         'create_meta_instance',
41         'get_immutable_options',
42         'reset_package_cache_flag',
43         'update_package_cache_flag',
44         'wrap_method_body',
45
46         # doc'd with rebless_instance
47         'rebless_instance_away',
48     ],
49     'Class::MOP::Class::Immutable::Trait'             => ['.+'],
50     'Class::MOP::Class::Immutable::Class::MOP::Class' => ['.+'],
51     'Class::MOP::Instance'                            => [
52         qw( BUILDARGS
53             bless_instance_structure
54             is_dependent_on_superclasses ),
55     ],
56     'Class::MOP::Instance' => [
57         qw( BUILDARGS
58             bless_instance_structure
59             is_dependent_on_superclasses ),
60     ],
61     'Class::MOP::Method::Accessor' => [
62         qw( generate_accessor_method
63             generate_accessor_method_inline
64             generate_clearer_method
65             generate_clearer_method_inline
66             generate_predicate_method
67             generate_predicate_method_inline
68             generate_reader_method
69             generate_reader_method_inline
70             generate_writer_method
71             generate_writer_method_inline
72             initialize_body
73             )
74     ],
75     'Class::MOP::Method::Constructor' => [
76         qw( attributes
77             generate_constructor_method
78             generate_constructor_method_inline
79             initialize_body
80             meta_instance
81             options
82             )
83     ],
84     'Class::MOP::Method::Generated' => [
85         qw( new
86             definition_context
87             is_inline
88             initialize_body
89             )
90     ],
91     'Class::MOP::Module' => ['create'],
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 }