blib/lib/Test2/Plugin/ExitSummary.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 12 / 12 Conditioncond 94.4% 17 / 18 MC/DCmcdc 88.8% 8 / 9 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 94.3% 67 / 71 CC 13 SCAR 21.3
CC
13
Cov
98%
summary
12.0
import
2.0
BEGIN
1.0
CRAP 8.4
« blib/lib/Test2/Compare/Float.pm ↑ Summary blib/lib/Test/More.pm »
1 package Test2::Plugin::ExitSummary;
2 167 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 167 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 167 our $VERSION = '1.302226';
6  
7 167 ▶use Test2::API qw/test2_add_callback_exit/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 167 my $ADDED_HOOK = 0;
10 177 ▶sub import { test2_add_callback_exit(\&summary) unless $ADDED_HOOK++ }
Subroutine import: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
unless $ADDED_HOOK++ 167 10 177
11  
12 5 ▶sub active { $ADDED_HOOK }
Subroutine active: called CC=1 SCAR=0.0
Pod undocumented
13  
14 125 ▶sub summary {
Subroutine summary: called CC=12 SCAR=24.9
Pod undocumented
15 125 my ($ctx, $real, $new) = @_;
16  
17 # Avoid double-printing diagnostics if Test::Builder already loaded.
18 125 ▶ return if $INC{'Test/Builder.pm'};
Branch: 1 branch
BranchTrueFalseTotal
if $INC{"Test/Builder.pm"} 1 124 125
19  
20 124 my $hub = $ctx->hub;
21 124 my $plan = $hub->plan;
22 124 my $count = $hub->count;
23 124 my $failed = $hub->failed;
24  
25 124 ▶ $ctx->diag('No tests run!') if !$count && (!$plan || $plan ne 'SKIP');
Branch: 1 branch
BranchTrueFalseTotal
if not $count and !$plan || $plan ne "SKIP" 2 122 124
Condition100%6/6
not $count and !$plan || $plan ne "SKIP"
!ll&&!rl&&r
11572
not $plan or $plan ne "SKIP"
l!l&&r!l&&!r
117
MC/DC100%3/3
not $count and !$plan || $plan ne "SKIP"
not $count not $plan $plan ne "SKIP"
Truth table100%4/4
not(A) and not(B) or C
A= not $countB= not $planC= $plan ne "SKIP"
ABCresult
0XX0
1000
11X1
1011
26 124 ▶ $ctx->diag('Tests were run but no plan was declared and done_testing() was not seen.')
Branch: 1 branch
BranchTrueFalseTotal
if $count and not $plan 1 123 124
Condition100%3/3
$count and not $plan
!ll&&!rl&&r
91141
MC/DC100%2/2
$count and not $plan
$count not $plan
Truth table100%3/3
A and not(B)
A= $countB= not $plan
ABresult
0X0
100
111
27 if $count && !$plan;
28  
29 124 ▶ $ctx->diag("Looks like your test exited with $real after test #$count.")
Branch: 1 branch
BranchTrueFalseTotal
if $real 1 123 124
30 if $real;
31  
32 124 ▶ $ctx->diag("Did not follow plan: expected $plan, ran $count.")
Branch: 1 branch
BranchTrueFalseTotal
if $plan and $plan =~ /^[0-9]+$/ and defined $count and $count != $plan 1 123 124
Condition88%8/9
$plan and $plan =~ /^[0-9]+$/ and defined $count and $count != $plan
!ll&&!rl&&r
91141
$plan and $plan =~ /^[0-9]+$/ and defined $count
!ll&&!rl&&r
90115
$plan and $plan =~ /^[0-9]+$/
!ll&&!rl&&r
27115
MC/DC75%3/4
$plan and $plan =~ /^[0-9]+$/ and defined $count and $count != $plan
$plan $plan =~ /^[0-9]+$/ defined $count $count != $plan
Truth table80%4/5
A and B and C and D
A= $planB= $plan =~ /^[0-9]+$/C= defined $countD= $count != $plan
ABCDresult
0XXX0
10XX0
110X0
11100
11111
33 if $plan && $plan =~ m/^[0-9]+$/ && defined $count && $count != $plan;
34 }
35  
36 167 1;
37  
38 __END__
« blib/lib/Test2/Compare/Float.pm ↑ Summary blib/lib/Test/More.pm »