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