From 3ffe754d14d144594a9cbca35fd77b7f25a5a285 Mon Sep 17 00:00:00 2001 From: Steve Hay Date: Thu, 5 Jun 2014 14:22:50 +0100 Subject: Add optional Perl::Critic testing --- Changes | 1 + MANIFEST | 1 + Makefile.PL | 11 +++++++++++ t/critic.t | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 t/critic.t 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(); + } +} + +#=============================================================================== -- cgit v1.2.3-24-ge0c7