Tangerine/hook/testrequires.pm

filter: Statementstmt 100% 48 / 48 Branchbran 72.2% 13 / 18 Conditioncond 78.2% 18 / 23 MC/DCmcdc 58.3% 7 / 12 Subroutinesub 100% 11 / 11 Podpod 100% 1 / 1 totaltotal 86.7% 98 / 113 CC 18 SCAR 25.4
CC
18
Cov
89%
run
19.1
BEGIN
1.0
BEGIN
1.0
CRAP 12.6
« Tangerine/hook/list.pm ↑ Summary Tangerine/hook/mooselike.pm »
1 package Tangerine::hook::testrequires;
2 16 $Tangerine::hook::testrequires::VERSION = '0.23';
3 16 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 16 ▶use parent 'Tangerine::Hook';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 16 ▶use Tangerine::HookData;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 16 ▶use Tangerine::Occurence;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 16 ▶use Tangerine::Utils qw(any stripquotelike $vre);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 148 ▶sub run {
Subroutine run: called CC=18 SCAR=29.5
Pod documented
12 148 my ($self, $s) = @_;
13 148 my %found;
14 148 ▶ if ($self->type eq 'compile' &&
Branch: 2 branches
BranchTrueFalseTotal
if ($self->type eq 'compile' and &any(sub { $s->[0] eq $_; } , 'use', 'no') and scalar @$s > 2 and &any(sub { $s->[1] eq $_; } , 'Test::Needs', 'Test::Requires')) { } 6 142 148
elsif ($self->type eq 'runtime' and &any(sub { $s->[0] eq $_; } , 'test_needs', 'test_requires') and scalar @$s > 1) { } 4 138 142
Condition100%9/9
$self->type eq "compile" and &any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 2 and &any(sub { $s->[1] eq $_; } , "Test::Needs", "Test::Requires")
!ll&&!rl&&r
71716
$self->type eq "compile" and &any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 2
!ll&&!rl&&r
67477
$self->type eq "compile" and &any(sub { $s->[0] eq $_; } , "use", "no")
!ll&&!rl&&r
105781
MC/DC100%4/4
$self->type eq "compile" and &any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 2 and &any(sub { $s->[1] eq $_; } , "Test::Needs", "Test::Requires")
$self->type eq "compile" &any(sub { $s->[0] eq $_; } , "use", "no") scalar @$s > 2 &any(sub { $s->[1] eq $_; } , "Test::Needs", "Test::Requires")
Truth table100%5/5
A and B and C and D
A= $self->type eq "compile"B= &any(sub { $s->[0] eq $_; } , "use", "no")C= scalar @$s > 2D= &any(sub { $s->[1] eq $_; } , "Test::Needs", "Test::Requires")
ABCDresult
0XXX0
10XX0
110X0
11100
11111
15 195 ▶ (any { $s->[0] eq $_ } qw(use no)) && scalar(@$s) > 2 &&
Subroutine __ANON__: called CC=1 SCAR=0.0
16 151 ▶ (any { $s->[1] eq $_ } qw(Test::Needs Test::Requires))) {
Subroutine __ANON__: called CC=1 SCAR=0.0
17 6 my ($version) = $s->[2] =~ $vre;
18 6 ▶ $version //= '';
Condition50%1/2
$version //= ""
l!l
06
MC/DC0%0/1
$version //= ""
$version
Truth table50%1/2
A
A= $version
Aresult
11
00
19 6 ▶ return if !$version && stripquotelike($s->[2]) =~ /^v?5(?:\..*)?$/;
Branch: 1 branch
BranchTrueFalseTotal
if not $version and stripquotelike($s->[2]) =~ /^v?5(?:\..*)?$/ 0 6 6
Condition33%1/3
not $version and stripquotelike($s->[2]) =~ /^v?5(?:\..*)?$/
!ll&&!rl&&r
060
MC/DC0%0/2
not $version and stripquotelike($s->[2]) =~ /^v?5(?:\..*)?$/
not $version stripquotelike($s->[2]) =~ /^v?5(?:\..*)?$/
Truth table33%1/3
not(A) and B
A= not $versionB= stripquotelike($s->[2]) =~ /^v?5(?:\..*)?$/
ABresult
0X0
100
111
20 6 ▶ my $voffset = $version ? 3 : 2;
Branch: 1 branch
BranchTrueFalseTotal
$version ? : 0 6 6
21 6 my @args;
22 6 ▶ if (scalar(@$s) > $voffset) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$s > $voffset) 6 0 6
23 6 ▶ return if $s->[$voffset] eq ';';
Branch: 1 branch
BranchTrueFalseTotal
if $s->[$voffset] eq ";" 0 6 6
24 6 @args = @$s;
25 6 @args = @args[($voffset) .. $#args];
26 6 @args = stripquotelike(@args);
27 }
28 6 ▶ if (substr($s->[$voffset], 0, 1) eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($s->[$voffset], 0, 1) eq '{') { } 2 4 6
29 2 %found = @args;
30 } else {
31 4 %found = map { $_ => '' } @args;
32 }
33 ▶ } elsif ($self->type eq 'runtime' &&
Condition83%5/6
$self->type eq "runtime" and &any(sub { $s->[0] eq $_; } , "test_needs", "test_requires") and scalar @$s > 1
!ll&&!rl&&r
13804
$self->type eq "runtime" and &any(sub { $s->[0] eq $_; } , "test_needs", "test_requires")
!ll&&!rl&&r
13264
MC/DC66%2/3
$self->type eq "runtime" and &any(sub { $s->[0] eq $_; } , "test_needs", "test_requires") and scalar @$s > 1
$self->type eq "runtime" &any(sub { $s->[0] eq $_; } , "test_needs", "test_requires") scalar @$s > 1
Truth table75%3/4
A and B and C
A= $self->type eq "runtime"B= &any(sub { $s->[0] eq $_; } , "test_needs", "test_requires")C= scalar @$s > 1
ABCresult
0XX0
10X0
1100
1111
34 18 ▶ (any { $s->[0] eq $_ } qw(test_needs test_requires)) && scalar(@$s) > 1) {
Subroutine __ANON__: called CC=1 SCAR=0.0
35 4 ▶ return if $s->[1] eq ';';
Branch: 1 branch
BranchTrueFalseTotal
if $s->[1] eq ";" 0 4 4
36 4 my @args = stripquotelike((@$s)[1..$#$s]);
37 4 ▶ $found{$args[0]} = $args[1] && $args[1] ne ';' ? $args[1] : '';
Branch: 1 branch
BranchTrueFalseTotal
$args[1] && $args[1] ne ';' ? : 2 2 4
Condition66%2/3
$args[1] and $args[1] ne ";"
!ll&&!rl&&r
202
MC/DC50%1/2
$args[1] and $args[1] ne ";"
$args[1] $args[1] ne ";"
Truth table66%2/3
A and B
A= $args[1]B= $args[1] ne ";"
ABresult
0X0
100
111
38 } else {
39 return
40 138 }
41 return Tangerine::HookData->new(
42 modules => {
43 map {
44 10 ( $_ => Tangerine::Occurence->new(version => $found{$_}) )
45 } keys %found,
46 },
47 )
48 }
49  
50 16 1;
51  
52 __END__
« Tangerine/hook/list.pm ↑ Summary Tangerine/hook/mooselike.pm »