Add ARM files
[dh-make-perl] / dev / arm / libperl-critic-perl / libperl-critic-perl-1.088 / xt / author / 40_criticize-code.t
diff --git a/dev/arm/libperl-critic-perl/libperl-critic-perl-1.088/xt/author/40_criticize-code.t b/dev/arm/libperl-critic-perl/libperl-critic-perl-1.088/xt/author/40_criticize-code.t
new file mode 100644 (file)
index 0000000..21dd462
--- /dev/null
@@ -0,0 +1,93 @@
+#!perl
+
+##############################################################################
+#      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/xt/author/40_criticize-code.t $
+#     $Date: 2008-05-04 17:25:51 -0500 (Sun, 04 May 2008) $
+#   $Author: clonezone $
+# $Revision: 2319 $
+##############################################################################
+
+# Self-compliance tests
+
+use strict;
+use warnings;
+
+use English qw( -no_match_vars );
+
+use File::Spec qw();
+use Test::More;
+
+use Perl::Critic::Utils qw{ :characters };
+use Perl::Critic::TestUtils qw{ starting_points_including_examples };
+
+# Note: "use PolicyFactory" *must* appear after "use TestUtils" for the
+# -extra-test-policies option to work.
+use Perl::Critic::PolicyFactory (
+    '-test' => 1,
+    '-extra-test-policies' => [ qw{ ErrorHandling::RequireUseOfExceptions } ],
+);
+
+#-----------------------------------------------------------------------------
+
+eval { require Test::Perl::Critic; };
+plan skip_all => 'Test::Perl::Critic required to criticise code' if $EVAL_ERROR;
+
+#-----------------------------------------------------------------------------
+
+eval { require Perl::Critic::Policy::ErrorHandling::RequireUseOfExceptions; };
+plan skip_all =>
+    'ErrorHandling::RequireUseOfExceptions policy required to criticise code.'
+        . ' This policy is part of the Perl::Critic::More distribution.'
+    if $EVAL_ERROR;
+
+#-----------------------------------------------------------------------------
+# Set up PPI caching for speed (used primarily during development)
+
+if ( $ENV{PERL_CRITIC_CACHE} ) {
+    require PPI::Cache;
+    my $cache_path =
+        File::Spec->catdir(
+            File::Spec->tmpdir,
+            "test-perl-critic-cache-$ENV{USER}",
+        );
+    if ( ! -d $cache_path) {
+        mkdir $cache_path, oct 700;
+    }
+    PPI::Cache->import( path => $cache_path );
+}
+
+#-----------------------------------------------------------------------------
+# Strict object testing -- prevent direct hash key access
+
+eval { require Devel::EnforceEncapsulation; };
+if ( !$EVAL_ERROR ) {
+    for my $pkg ( $EMPTY, '::Config', '::Policy', '::Violation' ) {
+        Devel::EnforceEncapsulation->apply_to('Perl::Critic'.$pkg);
+    }
+}
+else {
+    diag($EMPTY);
+    diag(
+        'You should install Devel::EnforceEncapsulation, but other tests '
+            . 'will still run.'
+    );
+}
+
+#-----------------------------------------------------------------------------
+# Run critic against all of our own files
+
+my $rcfile = File::Spec->catfile( 'xt', 'author', '40_perlcriticrc-code' );
+Test::Perl::Critic->import( -profile => $rcfile );
+
+all_critic_ok( starting_points_including_examples() );
+
+#-----------------------------------------------------------------------------
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 78
+#   indent-tabs-mode: nil
+#   c-indentation-style: bsd
+# End:
+# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :