blib/lib/TAP/Harness/Restricted.pm

filter: Statementstmt 100% 37 / 37 Branchbran 87.5% 7 / 8 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 94.6% 53 / 56 SCAR 17.9
CC
6
Cov
96%
_file_ok
5.0
aggregate_tests
2.0
BEGIN
1.0
CRAP 6.0
↑ Summary
1 1 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package TAP::Harness::Restricted;
6 # ABSTRACT: Skip some test files
7 1 our $VERSION = '0.003'; # VERSION
8  
9 1 ▶use superclass 'TAP::Harness' => 3.18;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub aggregate_tests {
13 1 ▶ my ( $self, $aggregate, @tests ) = @_;
Subroutine aggregate_tests: called CC=2 SCAR=7.0
Pod documented
14 3 ▶ my %banned_files = map { $_ => undef } map { glob } split " ",
Condition50%1/2
$ENV{'HARNESS_SKIP'} || ''
l!l
10
MC/DC0%0/1
$ENV{'HARNESS_SKIP'} || ''
$ENV{'HARNESS_SKIP'}
Truth table50%1/2
A
A= $ENV{'HARNESS_SKIP'}
Aresult
11
00
15 1 $ENV{HARNESS_SKIP} || '';
16 1 @tests = grep { _file_ok( $_, \%banned_files ) } @tests;
17 1 return $self->SUPER::aggregate_tests( $aggregate, @tests );
18 }
19  
20 1 my $maybe_prefix = qr/(?:\d+[_-]?)?/;
21  
22 1 my @banned_names =
23 ( qr/${maybe_prefix}pod\.t/, qr/${maybe_prefix}pod[_-]?coverage\.t/, );
24  
25 1 my @banned_code = (
26 qr/use Test::Pod/, # also gets Test::Pod::Coverage
27 );
28  
29 sub _file_ok {
30 13 ▶ my $file = path(shift);
Subroutine _file_ok: called CC=5 SCAR=16.1
31 13 my $banned_files = shift;
32 13 ▶ return unless $file->exists;
Branch: 1 branch
BranchTrueFalseTotal
unless $file->exists 0 13 13
33 13 my $basename = $file->basename;
34 13 ▶ return if grep { $basename =~ $_ } @banned_names;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$basename =~ /$_/;} @banned_names 6 7 13
35 7 ▶ return if exists $banned_files->{ $file->relative };
Branch: 1 branch
BranchTrueFalseTotal
if exists $$banned_files{$file->relative} 3 4 7
36 4 my $guts = $file->slurp;
37 4 ▶ return if grep { $guts =~ m{$_}ms } @banned_code;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$guts =~ /$_/ms;} @banned_code 2 2 4
38 2 return 1;
39 }
40  
41 1 1;
42  
43  
44 # vim: ts=4 sts=4 sw=4 et:
45  
46 __END__
↑ Summary