Login
Need to load extra RequireRcsKeywords policy for self-compliance tests.
[gknop/Perl-Critic.git] / xt / author / 42_criticize-tests.t
CommitLineData
c5c82e5d
ES
1#!perl
2
3##############################################################################
4# $URL$
5# $Date$
6# $Author$
7# $Revision$
8##############################################################################
9
10# Self-compliance tests
11
12use strict;
13use warnings;
14
15use English qw( -no_match_vars );
16
17use File::Spec qw();
c5c82e5d
ES
18
19use Perl::Critic::Utils qw{ :characters };
20use Perl::Critic::TestUtils qw{ starting_points_including_examples };
21
22# Note: "use PolicyFactory" *must* appear after "use TestUtils" for the
23# -extra-test-policies option to work.
a139189f
JRT
24use Perl::Critic::PolicyFactory (
25 '-test' => 1,
26 '-extra-test-policies' => [ qw{ ErrorHandling::RequireUseOfExceptions
27 Miscellanea::RequireRcsKeywords } ],
28);
c5c82e5d 29
b185fa17
ES
30use Test::More;
31
32#-----------------------------------------------------------------------------
33
7f30e919 34our $VERSION = '1.116';
b185fa17 35
c5c82e5d
ES
36#-----------------------------------------------------------------------------
37
ecd1a86a 38use Test::Perl::Critic;
c5c82e5d
ES
39
40#-----------------------------------------------------------------------------
41
ecd1a86a
ES
42# Fall over if P::C::More isn't installed.
43use Perl::Critic::Policy::ErrorHandling::RequireUseOfExceptions;
c5c82e5d
ES
44
45#-----------------------------------------------------------------------------
46# Set up PPI caching for speed (used primarily during development)
47
48if ( $ENV{PERL_CRITIC_CACHE} ) {
49 require PPI::Cache;
50 my $cache_path =
51 File::Spec->catdir(
52 File::Spec->tmpdir,
53 "test-perl-critic-cache-$ENV{USER}",
54 );
55 if ( ! -d $cache_path) {
56 mkdir $cache_path, oct 700;
57 }
58 PPI::Cache->import( path => $cache_path );
59}
60
61#-----------------------------------------------------------------------------
62# Run critic against all of our own files
63
64my $rcfile = File::Spec->catfile( 'xt', 'author', '42_perlcriticrc-tests' );
65Test::Perl::Critic->import( -profile => $rcfile );
66
67all_critic_ok(
68 glob ('t/*.t'),
69 glob ('xt/author/*.t'),
70 'generate_without_optional_dependencies_wrappers.PL',
71);
72
73#-----------------------------------------------------------------------------
74
75# Local Variables:
76# mode: cperl
77# cperl-indent-level: 4
78# fill-column: 78
79# indent-tabs-mode: nil
80# c-indentation-style: bsd
81# End:
82# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :