lib/Perl/PrereqScanner/NotQuiteLite/Parser/TestRequires.pm

filter: Statementstmt 93.5% 29 / 31 Branchbran 71.4% 10 / 14 Conditioncond 100% 6 / 6 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 3 totaltotal 85.7% 54 / 63 SCAR 25.0
CC
12
Cov
88%
parse_test_requires_args
11.6
parse_test_requires_function_args
2.0
BEGIN
1.0
CRAP 12.2
« lib/Perl/PrereqScanner/NotQuiteLite/Util/Prereqs.pm ↑ Summary lib/Perl/PrereqScanner/NotQuiteLite/Parser/Catalyst.pm »
1 package Perl::PrereqScanner::NotQuiteLite::Parser::TestRequires;
2  
3 88 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 88 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 88 ▶use Perl::PrereqScanner::NotQuiteLite::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 sub register { return {
8 87 ▶ use => {
Subroutine register: called CC=1 SCAR=0.0
Pod undocumented
9 'Test::Requires' => 'parse_test_requires_args',
10 },
11 }}
12  
13 sub parse_test_requires_args {
14 5 ▶ my ($class, $c, $used_module, $raw_tokens) = @_;
Subroutine parse_test_requires_args: called CC=11 SCAR=24.5
Pod undocumented
15  
16 5 $c->register_keyword_parser(
17 'test_requires',
18 [$class, 'parse_test_requires_function_args', $used_module],
19 );
20  
21 5 my $tokens = convert_string_tokens($raw_tokens);
22 5 ▶ if (is_version($tokens->[0])) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_version($tokens->[0])) 0 5 5
23 0 $c->add($used_module => shift @$tokens);
24 }
25  
26 5 ▶ if (ref $tokens->[0] and $tokens->[0][1] and $tokens->[0][1] eq '{}') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $tokens->[0] and $tokens->[0][1] and $tokens->[0][1] eq '{}') { } 1 4 5
Condition100%6/6
ref $tokens->[0] and $tokens->[0][1] and $tokens->[0][1] eq "{}"
!ll&&!rl&&r
311
ref $tokens->[0] and $tokens->[0][1]
!ll&&!rl&&r
212
MC/DC100%3/3
ref $tokens->[0] and $tokens->[0][1] and $tokens->[0][1] eq "{}"
ref $tokens->[0] $tokens->[0][1] $tokens->[0][1] eq "{}"
Truth table100%4/4
A and B and C
A= ref $tokens->[0]B= $tokens->[0][1]C= $tokens->[0][1] eq "{}"
ABCresult
0XX0
10X0
1100
1111
27 1 my $tokens_in_hashref = convert_string_tokens($tokens->[0][0]);
28 1 ▶ while(my ($key, undef, $value, undef) = splice @$tokens_in_hashref, 0, 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (my($key, undef, $value, undef) = splice(@$tokens_in_hashref, 0, 4)) 1 1 2
29 1 ▶ next unless is_module_name($key);
Branch: 1 branch
BranchTrueFalseTotal
unless is_module_name($key) 0 1 1
30 1 ▶ next unless is_version($value);
Branch: 1 branch
BranchTrueFalseTotal
unless is_version($value) 0 1 1
31 1 $c->add_recommendation($key => $value);
32 }
33 } else {
34 4 for my $token (@$tokens) {
35 6 ▶ next if ref $token;
Branch: 1 branch
BranchTrueFalseTotal
if ref $token 4 2 6
36 2 ▶ if ($token =~ /^v?5/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token =~ /^v?5/) { } 0 2 2
37 0 $c->add_recommendation(perl => $token);
38 } else {
39 2 $c->add_recommendation($token => 0);
40 }
41 }
42 }
43 }
44  
45 sub parse_test_requires_function_args {
46 1 ▶ my ($class, $c, $used_module, $raw_tokens) = @_;
Subroutine parse_test_requires_function_args: called CC=2 SCAR=6.9
Pod undocumented
47  
48 1 my $tokens = convert_string_tokens($raw_tokens);
49 1 $c->add_recommendation($_ => 0) for grep {!ref $_} @$tokens;
50 }
51  
52 88 1;
53  
54 __END__
« lib/Perl/PrereqScanner/NotQuiteLite/Util/Prereqs.pm ↑ Summary lib/Perl/PrereqScanner/NotQuiteLite/Parser/Catalyst.pm »