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