blib/lib/Tapper/CLI/Utils.pm

filter: Statementstmt 78.3% 29 / 37 Branchbran 66.6% 4 / 6 Conditioncond 60.0% 3 / 5 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 85.7% 6 / 7 Podpod 50.0% 1 / 2 totaltotal 73.3% 44 / 60 CC 6 SCAR 13.1
CC
6
Cov
75%
apply_macro
6.2
gen_self_docu
2.0
BEGIN
1.0
CRAP 3.7
« blib/lib/Tapper/CLI/Notification.pm ↑ Summary blib/lib/Tapper/CLI/API.pm »
1 package Tapper::CLI::Utils;
2 2 our $AUTHORITY = 'cpan:TAPPER';
3 2 $Tapper::CLI::Utils::VERSION = '5.0.8';
4  
5 2 ▶use parent 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Tapper::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 our @EXPORT_OK=qw(apply_macro gen_self_docu);
13  
14  
15  
16 sub apply_macro
17 2 ▶{
Subroutine apply_macro: called CC=6 SCAR=18.3
Pod documented
18 2 my ($macro_text, $substitutes, $given_includes) = @_;
19  
20 2 my @standard_includes = (Tapper::Config->subconfig->{paths}{testplan_path}, '.');
21 2 ▶ my $include_path_list = join ":", @standard_includes, @{$given_includes || []};
Condition50%1/2
$given_includes || []
l!l
20
MC/DC0%0/1
$given_includes || []
$given_includes
Truth table50%1/2
A
A= $given_includes
Aresult
11
00
22  
23 2 my $tt = Template->new({INCLUDE_PATH => $include_path_list, ABSOLUTE => 1});
24 2 my $ttapplied;
25  
26 2 ▶ if ($macro_text =~ /\n/ or not -e $macro_text) {
Branch: 1 branch
BranchTrueFalseTotal
if ($macro_text =~ /\n/ or not -e $macro_text) { } 1 1 2
Condition66%2/3
$macro_text =~ /\n/ or not -e $macro_text
l!l&&r!l&&!r
101
MC/DC50%1/2
$macro_text =~ /\n/ or not -e $macro_text
$macro_text =~ /\n/ not -e $macro_text
Truth table66%2/3
A or not(B)
A= $macro_text =~ /\n/B= not -e $macro_text
ABresult
1X1
011
000
27 1 ▶ $tt->process(\$macro_text, $substitutes, \$ttapplied) or die $tt->error();
Branch: 1 branch
BranchTrueFalseTotal
$tt->process(\$macro_text, $substitutes, \$ttapplied) or die $tt->error 1 0 1
28 } else {
29 1 ▶ $tt->process($macro_text, $substitutes, \$ttapplied) or die $tt->error();
Branch: 1 branch
BranchTrueFalseTotal
$tt->process($macro_text, $substitutes, \$ttapplied) or die $tt->error 1 0 1
30 }
31  
32 2 return $ttapplied;
33 }
34  
35  
36 sub gen_self_docu
37 0 ▶{
Subroutine gen_self_docu: not called CC=1 SCAR=6.9
Pod undocumented
38 0 my ($text) = @_;
39 0 my @guide = grep { m/^###/ } split (qr/\n/, $text);
40 0 my $self_docu = "Self-documentation:\n";
41 0 $self_docu.= join "\n", map { my $l = $_; $l =~ s/^###/ /; "$l\n" } @guide;
42 }
43  
44  
45 2 1;
46  
47 __END__
« blib/lib/Tapper/CLI/Notification.pm ↑ Summary blib/lib/Tapper/CLI/API.pm »