10dfcf705cf520598f4de6a35aeb6abb175519f0
[pkg-perl] / deb-src / libperl-critic-perl / libperl-critic-perl-1.088 / xt / author / 41_criticize-policies.t
1 #!perl
2
3 ##############################################################################
4 #      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/xt/author/41_criticize-policies.t $
5 #     $Date: 2008-05-04 18:52:15 -0500 (Sun, 04 May 2008) $
6 #   $Author: clonezone $
7 # $Revision: 2320 $
8 ##############################################################################
9
10 # Extra self-compliance tests for Policies.
11
12 use strict;
13 use warnings;
14
15 use English qw< -no_match_vars >;
16
17 use File::Spec qw<>;
18
19 use Test::More;
20
21 use Perl::Critic::PolicyFactory ( '-test' => 1 );
22
23 #-----------------------------------------------------------------------------
24
25 eval { require Test::Perl::Critic; };
26 plan skip_all => 'Test::Perl::Critic required to criticise code' if $EVAL_ERROR;
27
28 #-----------------------------------------------------------------------------
29
30 # Set up PPI caching for speed (used primarily during development)
31
32 if ( $ENV{PERL_CRITIC_CACHE} ) {
33     require PPI::Cache;
34     my $cache_path =
35         File::Spec->catdir(
36             File::Spec->tmpdir(),
37             "test-perl-critic-cache-$ENV{USER}"
38         );
39     if ( ! -d $cache_path) {
40         mkdir $cache_path, oct 700;
41     }
42     PPI::Cache->import( path => $cache_path );
43 }
44
45 #-----------------------------------------------------------------------------
46 # Run critic against all of our own files
47
48 my $rcfile = File::Spec->catfile( qw< xt author 41_perlcriticrc-policies > );
49 Test::Perl::Critic->import( -profile => $rcfile );
50
51 my $path =
52     File::Spec->catfile(
53         -e 'blib' ? 'blib/lib' : 'lib',
54         qw< Perl Critic Policy >,
55     );
56 all_critic_ok( $path );
57
58 #-----------------------------------------------------------------------------
59
60 # Local Variables:
61 #   mode: cperl
62 #   cperl-indent-level: 4
63 #   fill-column: 78
64 #   indent-tabs-mode: nil
65 #   c-indentation-style: bsd
66 # End:
67 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :