Login
Comply with our own RequirePodSections policy
[gknop/Perl-Critic.git] / t / 99_pod_coverage.t
CommitLineData
27c1472f
JRT
1##################################################################
2# $URL$
3# $Date$
4# $Author$
5# $Revision$
6##################################################################
7
59b05e08
JRT
8use strict;
9use warnings;
10use Test::More;
11
32c50ab8 12eval 'use Test::Pod::Coverage 1.04'; ## no critic
59b05e08 13plan skip_all => 'Test::Pod::Coverage 1.00 requried to test POD' if $@;
acd594cd
JRT
14
15{
16 # HACK: Perl::Critic::Violation uses Pod::Parser to extract the
17 # DIAGNOSTIC section of the POD in each Policy module. This
18 # happens when the Policy first C<uses> the Violation module.
19 # Meanwhile, Pod::Coverage also uses Pod::Parser to extract the
20 # POD and compare it with the subroutines that are in the symbol
21 # table for that module. For reasons I cannot yet explain, using
22 # Pod::Parser twice this way causes the symbol table to get very
23 # wacky and this test script dies with "Can't call method 'OPEN'
24 # on IO::String at line 1239 of Pod/Parser.pm".
25
26 # For now, my workaround is to temporarily redefine the import()
27 # method in the Violation module so that it doesn't do any Pod
28 # parsing. I'll look for a better solution (or file a bug report)
29 # when / if I have better understanding of the problem.
30
31 no warnings;
32 require Perl::Critic::Violation;
33 *Perl::Critic::Violation::import = sub { 1 };
34}
35
557d93b1 36my $trusted_rx = qr{ \A (?: new | violates | applies_to | default_severity ) \z }x;
7e86d49a 37my $trustme = { trustme => [ $trusted_rx ] };
acd594cd 38all_pod_coverage_ok( $trustme );