Add permanent plumbing for _TempExtlib (d0435d75)
[dbsrgits/DBIx-Class.git] / xt / dist / pod_coverage.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
cb551b07 2use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_podcoverage';
3
dc4600b2 4use warnings;
5use strict;
6
0fe5201a 7use Test::More;
554484cb 8use Module::Runtime 'require_module';
c0329273 9use lib 'maint/.Generated_Pod/lib';
dc4600b2 10use DBICTest;
6298a324 11use namespace::clean;
0fe5201a 12
f7ed0ed3 13# this has already been required but leave it here for CPANTS static analysis
14require Test::Pod::Coverage;
15
9b83fccd 16# Since this is about checking documentation, a little documentation
32978f6e 17# of what this is doing might be in order.
9b83fccd 18# The exceptions structure below is a hash keyed by the module
32978f6e 19# name. Any * in a name is treated like a wildcard and will behave
8c96bbc2 20# as expected. Modules are matched by longest string first, so
32978f6e 21# A::B::C will match even if there is A::B*
22
23# The value for each is a hash, which contains one or more
9b83fccd 24# (although currently more than one makes no sense) of the following
25# things:-
26# skip => a true value means this module is not checked
27# ignore => array ref containing list of methods which
28# do not need to be documented.
7eb4ecc8 29my $exceptions = {
30 'DBIx::Class' => {
517ba890 31 ignore => [qw/
32 MODIFY_CODE_ATTRIBUTES
33 component_base_class
d009cb7d 34 inject_base
517ba890 35 mk_classdata
36 mk_classaccessor
37 /]
b20edc27 38 },
cb551b07 39 'DBIx::Class::Optional::Dependencies' => {
40 ignore => [qw/
41 croak
42 /]
43 },
70c28808 44 'DBIx::Class::Carp' => {
45 ignore => [qw/
46 unimport
47 /]
48 },
0c62fa59 49 'DBIx::Class::Row' => {
517ba890 50 ignore => [qw/
51 MULTICREATE_DEBUG
52 /],
0c62fa59 53 },
cde96798 54 'DBIx::Class::FilterColumn' => {
55 ignore => [qw/
56 new
57 update
491c8ff9 58 store_column
59 get_column
60 get_columns
b482a095 61 get_dirty_columns
dc6dadae 62 has_column_loaded
cde96798 63 /],
64 },
bc984450 65 'DBIx::Class::ResultSource' => {
66 ignore => [qw/
517ba890 67 compare_relationship_keys
68 pk_depends_on
69 resolve_condition
70 resolve_join
71 resolve_prefetch
50261284 72 STORABLE_freeze
73 STORABLE_thaw
517ba890 74 /],
75 },
0b66414b 76 'DBIx::Class::ResultSet' => {
77 ignore => [qw/
78 STORABLE_freeze
79 STORABLE_thaw
80 /],
81 },
517ba890 82 'DBIx::Class::ResultSourceHandle' => {
83 ignore => [qw/
84 schema
85 source_moniker
bc984450 86 /],
87 },
b20edc27 88 'DBIx::Class::Storage' => {
517ba890 89 ignore => [qw/
90 schema
91 cursor
92 /]
7eb4ecc8 93 },
249963d4 94 'DBIx::Class::Schema' => {
517ba890 95 ignore => [qw/
96 setup_connection_class
97 /]
249963d4 98 },
32978f6e 99
100 'DBIx::Class::Schema::Versioned' => {
101 ignore => [ qw/
102 connection
517ba890 103 /]
00c937a2 104 },
737416a4 105
8c96bbc2 106 'DBIx::Class::Admin' => {
107 ignore => [ qw/
108 BUILD
109 /]
110 },
111
5f6a861d 112 'DBIx::Class::Storage::DBI::Replicated*' => {
113 ignore => [ qw/
114 connect_call_do_sql
115 disconnect_call_do_sql
116 /]
117 },
118
399b9455 119 'DBIx::Class::_TempExtlib*' => { skip => 1 },
120
97f9f16e 121 'DBIx::Class::Admin::*' => { skip => 1 },
32978f6e 122 'DBIx::Class::ClassResolver::PassThrough' => { skip => 1 },
123 'DBIx::Class::Componentised' => { skip => 1 },
db29433c 124 'DBIx::Class::AccessorGroup' => { skip => 1 },
32978f6e 125 'DBIx::Class::Relationship::*' => { skip => 1 },
126 'DBIx::Class::ResultSetProxy' => { skip => 1 },
127 'DBIx::Class::ResultSourceProxy' => { skip => 1 },
9550c834 128 'DBIx::Class::ResultSource::*' => { skip => 1 },
32978f6e 129 'DBIx::Class::Storage::Statistics' => { skip => 1 },
eb7afcab 130 'DBIx::Class::Storage::DBI::Replicated::Types' => { skip => 1 },
a4367b26 131 'DBIx::Class::GlobalDestruction' => { skip => 1 },
9345b14c 132 'DBIx::Class::Storage::BlockRunner' => { skip => 1 }, # temporary
737416a4 133
32978f6e 134# test some specific components whose parents are exempt below
32978f6e 135 'DBIx::Class::Relationship::Base' => {},
d5dedbd6 136 'DBIx::Class::SQLMaker::LimitDialects' => {},
737416a4 137
32978f6e 138# internals
b1dbf716 139 'DBIx::Class::_Util' => { skip => 1 },
d5dedbd6 140 'DBIx::Class::SQLMaker*' => { skip => 1 },
9fc20b28 141 'DBIx::Class::SQLAHacks*' => { skip => 1 },
32978f6e 142 'DBIx::Class::Storage::DBI*' => { skip => 1 },
143 'SQL::Translator::*' => { skip => 1 },
737416a4 144
32978f6e 145# deprecated / backcompat stuff
1b6fe47d 146 'DBIx::Class::Serialize::Storable' => { skip => 1 },
32978f6e 147 'DBIx::Class::CDBICompat*' => { skip => 1 },
148 'DBIx::Class::ResultSetManager' => { skip => 1 },
149 'DBIx::Class::DB' => { skip => 1 },
737416a4 150
32978f6e 151# skipped because the synopsis covers it clearly
152 'DBIx::Class::InflateColumn::File' => { skip => 1 },
cd122820 153
154# internal subclass, nothing to POD
155 'DBIx::Class::ResultSet::Pager' => { skip => 1 },
7eb4ecc8 156};
157
32978f6e 158my $ex_lookup = {};
159for my $string (keys %$exceptions) {
160 my $ex = $exceptions->{$string};
161 $string =~ s/\*/'.*?'/ge;
162 my $re = qr/^$string$/;
163 $ex_lookup->{$re} = $ex;
164}
165
47589465 166my @modules = sort { $a cmp $b } Test::Pod::Coverage::all_modules('lib');
32978f6e 167
7eb4ecc8 168foreach my $module (@modules) {
32978f6e 169 SKIP: {
170
6298a324 171 my ($match) =
87b12551 172 grep { $module =~ $_ }
32978f6e 173 (sort { length $b <=> length $a || $b cmp $a } (keys %$ex_lookup) )
174 ;
175
176 my $ex = $ex_lookup->{$match} if $match;
177
178 skip ("$module exempt", 1) if ($ex->{skip});
179
554484cb 180 skip ("$module not loadable", 1) unless eval { require_module($module) };
181
32978f6e 182 # build parms up from ignore list
183 my $parms = {};
184 $parms->{trustme} =
185 [ map { qr/^$_$/ } @{ $ex->{ignore} } ]
186 if exists($ex->{ignore});
187
188 # run the test with the potentially modified parm set
a109c954 189 Test::Pod::Coverage::pod_coverage_ok($module, $parms, "$module POD coverage");
32978f6e 190 }
7eb4ecc8 191}
32978f6e 192
193done_testing;