| 1 | package Tangerine::hook::testrequires; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 15 | $Tangerine::hook::testrequires::VERSION = '0.21'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 15 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 15 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 15 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 15 | ▶ | use parent 'Tangerine::Hook'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 15 | ▶ | use List::Util 1.33 qw(any); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 15 | ▶ | use Tangerine::HookData; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 15 | ▶ | use Tangerine::Occurence; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 15 | ▶ | use Tangerine::Utils qw(stripquotelike $vre); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | sub run { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 137 | ▶ | my ($self, $s) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=18 SCAR=29.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 137 | my %found; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 137 | ▶ | if ($self->type eq 'compile' && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%9/9
$self->type eq "compile" and &any(sub {
$s->[0] eq $_;
}
, "use", "no") and scalar @$s > 2 and $s->[1] eq "Test::Requires"
$self->type eq "compile" and &any(sub {
$s->[0] eq $_;
}
, "use", "no") and scalar @$s > 2
$self->type eq "compile" and &any(sub {
$s->[0] eq $_;
}
, "use", "no")
MC/DC100%4/4
$self->type eq "compile" and &any(sub {
$s->[0] eq $_;
}
, "use", "no") and scalar @$s > 2 and $s->[1] eq "Test::Requires"
$self->type eq "compile"
&any(sub {
$s->[0] eq $_;
}
, "use", "no")
scalar @$s > 2
$s->[1] eq "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= $s->[1] eq "Test::Requires"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 187 | ▶ | (any { $s->[0] eq $_ } qw(use no)) && scalar(@$s) > 2 && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | $s->[1] eq 'Test::Requires') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | my ($version) = $s->[2] =~ $vre; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 3 | ▶ | $version //= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$version //= ""
MC/DC0%0/1
$version //= ""
$version
Truth table50%1/2
A
A= $version
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | ▶ | return if !$version && stripquotelike($s->[2]) =~ /^v?5(?:\..*)?$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $version and stripquotelike($s->[2]) =~ /^v?5(?:\..*)?$/
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(?:\..*)?$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | ▶ | my $voffset = $version ? 3 : 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 3 | my @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 3 | ▶ | if (scalar(@$s) > $voffset) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 3 | ▶ | return if $s->[$voffset] eq ';'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 3 | @args = @$s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 3 | @args = @args[($voffset) .. $#args]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 3 | @args = stripquotelike(@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 3 | ▶ | if (substr($s->[$voffset], 0, 1) eq '{') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | %found = @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 2 | %found = map { $_ => '' } @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | ▶ | } elsif ($self->type eq 'runtime' && | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
$self->type eq "runtime" and $s->[0] eq "test_requires" and scalar @$s > 1
$self->type eq "runtime" and $s->[0] eq "test_requires"
MC/DC66%2/3
$self->type eq "runtime" and $s->[0] eq "test_requires" and scalar @$s > 1
$self->type eq "runtime"
$s->[0] eq "test_requires"
scalar @$s > 1
Truth table75%3/4
A and B and C
A= $self->type eq "runtime"B= $s->[0] eq "test_requires"C= scalar @$s > 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | $s->[0] eq 'test_requires' && scalar(@$s) > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 2 | ▶ | return if $s->[1] eq ';'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 2 | my @args = stripquotelike((@$s)[1..$#$s]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | ▶ | $found{$args[0]} = $args[1] && $args[1] ne ';' ? $args[1] : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$args[1] and $args[1] ne ";"
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 ";"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 132 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | return Tangerine::HookData->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | modules => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 5 | ( $_ => Tangerine::Occurence->new(version => $found{$_}) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } keys %found, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 15 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||