#!perl -wT -- -*- tab-width: 4; mode: perl -*-
# :: check test coverage
use strict;
use warnings;
{
## no critic ( ProhibitOneArgSelect RequireLocalizedPunctuationVars )
my $fh = select STDIN; $|++; select STDOUT; $|++; select STDERR; $|++; select $fh; # DISABLE buffering on STDIN, STDOUT, and STDERR
}
use Test::More;
plan skip_all => 'Author tests [to run: set TEST_AUTHOR]' unless ($ENV{TEST_AUTHOR} or $ENV{AUTHOR_TESTING}) or ($ENV{TEST_RELEASE} or $ENV{RELEASE_TESTING}) or $ENV{TEST_ALL} or $ENV{COVERAGE};
#my $haveTestStrict = eval { require Test::Strict; import Test::Strict; 1; };
#my $haveDevelCover = eval { require Devel::Cover; import Devel::Cover; 1; };
#
#plan skip_all => 'Test::Strict required to check coverage' if !$haveTestStrict;
#plan skip_all => 'Devel::Cover required to check coverage' if !$haveDevelCover;
use version qw();
my @modules = ( 'Test::Strict', 'Devel::Cover' ); # @modules = ( '<MODULE> [[<MIN_VERSION>] <MAX_VERSION>]', ... )
my $haveRequired = 1;
foreach (@modules) {my ($module, $min_v, $max_v) = split(' '); my $v = eval "require $module; $module->VERSION();"; if ( !$v || ($min_v && ($v < version->new($min_v))) || ($max_v && ($v > version->new($max_v))) ) { $haveRequired = 0; my $out = $module . ($min_v?' [v'.$min_v.($max_v?" - $max_v":'+').']':''); diag("$out is not available"); }} ## no critic (ProhibitStringyEval)
plan skip_all => '[ '.join(', ',@modules).' ] required for testing' if !$haveRequired;
#Test::Strict::all_perl_files_ok( @mydirs );
#Test::Strict::all_perl_files_ok( 'lib' );
Test::Strict::all_cover_ok( 50, 'lib' );