Login
ValuesAndExpressions::ProhibitLongChainsOfMethodCalls wasn't
[gknop/Perl-Critic.git] / t / 99_pod_coverage.t
CommitLineData
faa35de4
JRT
1#!perl
2
6036a254 3##############################################################################
27c1472f
JRT
4# $URL$
5# $Date$
6# $Author$
7# $Revision$
6036a254 8##############################################################################
27c1472f 9
59b05e08
JRT
10use strict;
11use warnings;
12use Test::More;
13
32c50ab8 14eval 'use Test::Pod::Coverage 1.04'; ## no critic
59b05e08 15plan skip_all => 'Test::Pod::Coverage 1.00 requried to test POD' if $@;
acd594cd
JRT
16
17{
18 # HACK: Perl::Critic::Violation uses Pod::Parser to extract the
19 # DIAGNOSTIC section of the POD in each Policy module. This
20 # happens when the Policy first C<uses> the Violation module.
21 # Meanwhile, Pod::Coverage also uses Pod::Parser to extract the
22 # POD and compare it with the subroutines that are in the symbol
23 # table for that module. For reasons I cannot yet explain, using
24 # Pod::Parser twice this way causes the symbol table to get very
25 # wacky and this test script dies with "Can't call method 'OPEN'
26 # on IO::String at line 1239 of Pod/Parser.pm".
27
28 # For now, my workaround is to temporarily redefine the import()
29 # method in the Violation module so that it doesn't do any Pod
30 # parsing. I'll look for a better solution (or file a bug report)
31 # when / if I have better understanding of the problem.
32
33 no warnings;
34 require Perl::Critic::Violation;
35 *Perl::Critic::Violation::import = sub { 1 };
36}
37
faa35de4
JRT
38my @trusted_methods = get_trusted_methods();
39my $method_string = join ' | ', @trusted_methods;
40my $trusted_rx = qr{ \A (?: $method_string ) \z }x;
41all_pod_coverage_ok( {trustme => [$trusted_rx]} );
42
43#-----------------------------------------------------------------------------
44
45sub get_trusted_methods {
46 return qw(
47 new
985e0116 48 initialize_if_enabled
faa35de4
JRT
49 violates
50 applies_to
51 default_themes
52 default_severity
e178fe38 53 supported_parameters
48336a64 54 got_sigpipe
faa35de4
JRT
55 );
56}
737d3b65 57
fd5bd7b5 58##############################################################################
737d3b65
CD
59# Local Variables:
60# mode: cperl
61# cperl-indent-level: 4
62# fill-column: 78
63# indent-tabs-mode: nil
64# c-indentation-style: bsd
65# End:
345c7562 66# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab :