| 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 || []
MC/DC0%0/1
$given_includes || []
$given_includes
Truth table50%1/2
A
A= $given_includes
| |||||||||||||||||||||||||||||
| 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
Condition66%2/3
$macro_text =~ /\n/ or not -e $macro_text
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
| |||||||||||||||||||||||||||||
| 27 | 1 | ▶ | $tt->process(\$macro_text, $substitutes, \$ttapplied) or die $tt->error(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | } else { | ||||||||||||||||||||||||||||
| 29 | 1 | ▶ | $tt->process($macro_text, $substitutes, \$ttapplied) or die $tt->error(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||