| 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
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")
$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 &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")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 //= ""
MC/DC0%0/1
$version //= ""
$version
Truth table50%1/2
A
A= $version
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 6 | ▶ | 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(?:\..*)?$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 6 | ▶ | my $voffset = $version ? 3 : 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 6 | my @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 6 | ▶ | if (scalar(@$s) > $voffset) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 6 | ▶ | return if $s->[$voffset] eq ';'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
$self->type eq "runtime" and &any(sub {
$s->[0] eq $_;
}
, "test_needs", "test_requires")
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 4 | my @args = stripquotelike((@$s)[1..$#$s]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 4 | ▶ | $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 ";"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||