about summary refs log tree commit
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2014-06-05 14:22:50 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2014-06-05 14:22:50 +0100
commit3ffe754d14d144594a9cbca35fd77b7f25a5a285 (patch)
tree5fa6cfe9772490f8bff86caced174087f2859c52
parent465ef26f5213110b0fbef4beb3f601d18dc2cb05 (diff)
downloadperl-libnet-3ffe754d14d144594a9cbca35fd77b7f25a5a285.tar.gz
Add optional Perl::Critic testing
-rw-r--r--Changes1
-rw-r--r--MANIFEST1
-rw-r--r--Makefile.PL11
-rw-r--r--t/critic.t44
4 files changed, 57 insertions, 0 deletions
diff --git a/Changes b/Changes
index 0767d0f..42ea3f7 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 libnet 1.28  -- TODO
 
   * Add optional POD testing.
+  * Add optional Perl::Critic testing.
   * Make code Perl::Critic clean.
   * Move Net/*.pm into lib/Net/ sub-directory within distribution. This is the
     usual layout style these days.
diff --git a/MANIFEST b/MANIFEST
index a9ddcc0..c484723 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -26,6 +26,7 @@ lib/Net/SMTP.pm                          Simple Mail Transfer Protocol Client
 lib/Net/Time.pm                          time & nettime protocols
 lib/Net/libnetFAQ.pod
 t/config.t
+t/critic.t
 t/datasend.t
 t/external/smtp-ssl.t
 t/external/pop3-ssl.t
diff --git a/Makefile.PL b/Makefile.PL
index a110530..3921a4a 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -117,6 +117,17 @@ MAIN: {
                     }
                 },
 
+                critictest => {
+                    description => 'Perl::Critic testing',
+                    prereqs => {
+                        test => {
+                            requires => {
+                                'Test::Perl::Critic' => '0'
+                            }
+                        }
+                    }
+                },
+
                 podtest => {
                     description => 'POD testing',
                     prereqs => {
diff --git a/t/critic.t b/t/critic.t
new file mode 100644
index 0000000..33fe49f
--- /dev/null
+++ b/t/critic.t
@@ -0,0 +1,44 @@
+#!perl
+#===============================================================================
+#
+# t/critic.t
+#
+# DESCRIPTION
+#   Test script to check Perl::Critic conformance.
+#
+# COPYRIGHT
+#   Copyright (C) 2014 Steve Hay.  All rights reserved.
+#
+# LICENCE
+#   You may distribute under the terms of either the GNU General Public License
+#   or the Artistic License, as specified in the LICENCE file.
+#
+#===============================================================================
+
+use 5.008001;
+
+use strict;
+use warnings;
+
+use Test::More;
+
+#===============================================================================
+# MAIN PROGRAM
+#===============================================================================
+
+MAIN: {
+    my $ok = eval {
+        require Test::Perl::Critic;
+        Test::Perl::Critic->import();
+        1;
+    };
+
+    if (not $ok) {
+        plan skip_all => 'Test::Perl::Critic required to test with Perl::Critic';
+    }
+    else {
+        all_critic_ok();
+    }
+}
+
+#===============================================================================