Smart/Renderer/Text.pm

filter: Statementstmt 100% 20 / 20 Branchbran 100% 8 / 8 Conditioncond 87.5% 7 / 8 MC/DCmcdc 75.0% 3 / 4 Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 93.1% 41 / 44 CC 10 SCAR 21.4
CC
10
Cov
97%
render
10.0
BEGIN
1.0
BEGIN
1.0
CRAP 8.5
« Smart/Renderer/Test2.pm ↑ Summary Smart/Path.pm »
1 package Data::Hash::Diff::Smart::Renderer::Text;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 74 ▶sub render {
Subroutine render: called CC=10 SCAR=23.0
Pod undocumented
7 74 my $changes = $_[0];
8  
9 74 ▶ return '' unless @{$changes};
Branch: 1 branch
BranchTrueFalseTotal
unless @{$changes;} 11 63 74
10  
11 63 my @out;
12  
13 63 for my $c (@$changes) {
14 101 my $op = $c->{op};
15 101 my $path = $c->{path};
16  
17 101 ▶ if ($op eq 'change') {
Branch: 3 branches
BranchTrueFalseTotal
if ($op eq 'change') { } 60 41 101
elsif ($op eq 'add') { } 21 20 41
elsif ($op eq 'remove') { } 17 3 20
18 push @out,
19 "~ $path",
20 '- ' . ($c->{from} // ''),
21 60 ▶ '+ ' . ($c->{to} // ''),
Condition100%4/4
$c->{"from"} // ""
l!l
582
$c->{"to"} // ""
l!l
591
MC/DC100%1/1
$c->{"from"} // ""
$c->{"from"}
MC/DC100%1/1
$c->{"to"} // ""
$c->{"to"}
Truth table100%2/2
A
A= $c->{"from"}
Aresult
11
00
Truth table100%2/2
A
A= $c->{"to"}
Aresult
11
00
22 '';
23 } elsif ($op eq 'add') {
24 push @out,
25 "+ $path",
26 21 ▶ '+ ' . ($c->{value} // ''),
Condition100%2/2
$c->{"value"} // ""
l!l
201
MC/DC100%1/1
$c->{"value"} // ""
$c->{"value"}
Truth table100%2/2
A
A= $c->{"value"}
Aresult
11
00
27 '';
28 } elsif ($op eq 'remove') {
29 push @out,
30 "- $path",
31 17 ▶ '- ' . ($c->{from} // ''),
Condition50%1/2
$c->{"from"} // ""
l!l
170
MC/DC0%0/1
$c->{"from"} // ""
$c->{"from"}
Truth table50%1/2
A
A= $c->{"from"}
Aresult
11
00
32 '';
33 } else {
34 3 push @out, "# unknown op: $op";
35 }
36 }
37  
38 63 return join("\n", @out) . "\n";
39 }
40  
41 6 1;
« Smart/Renderer/Test2.pm ↑ Summary Smart/Path.pm »