Login
Added hack to prevent RequireUseStrict and RequireUseWarnings from
[gknop/Perl-Critic.git] / t / 99_pod_coverage.t
CommitLineData
faa35de4
JRT
1#!perl
2
27c1472f
JRT
3##################################################################
4# $URL$
5# $Date$
6# $Author$
7# $Revision$
8##################################################################
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
48 violates
49 applies_to
50 default_themes
51 default_severity
52 );
53}
737d3b65
CD
54
55# Local Variables:
56# mode: cperl
57# cperl-indent-level: 4
58# fill-column: 78
59# indent-tabs-mode: nil
60# c-indentation-style: bsd
61# End:
345c7562 62# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab :