blib/lib/Test2/Hub/Subtest.pm

filter: Statementstmt 100% 53 / 53 Branchbran 83.3% 15 / 18 Conditioncond 58.3% 7 / 12 MC/DCmcdc 14.2% 1 / 7 Subroutinesub 100% 12 / 12 Podpod 25.0% 1 / 4 totaltotal 83.9% 89 / 106 CC 14 SCAR 16.1
CC
14
Cov
90%
terminate
8.2
send
7.2
BEGIN
1.0
CRAP 5.0
« blib/lib/Test2/Event/Plan.pm ↑ Summary blib/lib/Test/Builder/Formatter.pm »
1 package Test2::Hub::Subtest;
2 455 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 455 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 455 our $VERSION = '1.302226';
6  
7 455 ▶BEGIN { require Test2::Hub; our @ISA = qw(Test2::Hub) }
Subroutine BEGIN: called CC=1 SCAR=0.0
8 455 ▶use Test2::Util::HashBase qw/nested exit_code manual_skip_all/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 455 ▶use Test2::Util qw/get_tid/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 108 ▶sub is_subtest { 1 }
Subroutine is_subtest: called CC=1 SCAR=0.0
Pod undocumented
12  
13 521 ▶sub inherit {
Subroutine inherit: called CC=1 SCAR=0.0
Pod undocumented
14 521 my $self = shift;
15 521 my ($from) = @_;
16  
17 521 $self->SUPER::inherit($from);
18  
19 521 $self->{+NESTED} = $from->nested + 1;
20 }
21  
22 {
23 # Legacy
24 455 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
25 455 *ID = \&Test2::Hub::HID;
26 455 *id = \&Test2::Hub::hid;
27 455 *set_id = \&Test2::Hub::set_hid;
28 }
29  
30 4822 ▶sub send {
Subroutine send: called CC=7 SCAR=19.7
Pod documented
31 4822 my $self = shift;
32 4822 my ($e) = @_;
33  
34 4822 my $out = $self->SUPER::send($e);
35  
36 4809 ▶ return $out if $self->{+MANUAL_SKIP_ALL};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"manual_skip_all"} 6 4803 4809
37  
38 4803 my $f = $e->facet_data;
39  
40 4803 ▶ my $plan = $f->{plan} or return $out;
Branch: 1 branch
BranchTrueFalseTotal
my $plan = $f->{"plan"} or return $out 745 4058 4803
41 745 ▶ return $out unless $plan->{skip};
Branch: 1 branch
BranchTrueFalseTotal
unless $plan->{"skip"} 729 16 745
42  
43 16 ▶ my $trace = $f->{trace} or die "Missing Trace!";
Branch: 1 branch
BranchTrueFalseTotal
my $trace = $f->{"trace"} or die "Missing Trace!" 16 0 16
44 return $out unless $trace->{pid} != $self->pid
45 16 ▶ || $trace->{tid} != $self->tid;
Branch: 1 branch
BranchTrueFalseTotal
unless $trace->{"pid"} != $self->pid or $trace->{"tid"} != $self->tid 0 16 16
Condition33%1/3
$trace->{"pid"} != $self->pid or $trace->{"tid"} != $self->tid
l!l&&r!l&&!r
1600
MC/DC0%0/2
$trace->{"pid"} != $self->pid or $trace->{"tid"} != $self->tid
$trace->{"pid"} != $self->pid $trace->{"tid"} != $self->tid
Truth table33%1/3
A or B
A= $trace->{"pid"} != $self->pidB= $trace->{"tid"} != $self->tid
ABresult
1X1
011
000
46  
47 455 ▶ no warnings 'exiting';
Subroutine BEGIN: called CC=1 SCAR=0.0
48 16 last T2_SUBTEST_WRAPPER;
49 }
50  
51 150 ▶sub terminate {
Subroutine terminate: called CC=8 SCAR=21.0
Pod undocumented
52 150 my $self = shift;
53 150 my ($code, $e, $f) = @_;
54 150 $self->set_exit_code($code);
55  
56 150 ▶ return if $self->{+MANUAL_SKIP_ALL};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"manual_skip_all"} 19 131 150
57  
58 131 ▶ $f ||= $e->facet_data;
Condition66%2/3
$f ||= $e->facet_data
l!l&&r!l&&!r
13010
MC/DC0%0/2
$f ||= $e->facet_data
$f $e->facet_data
Truth table66%2/3
A ||= B
A= $fB= $e->facet_data
ABresult
1X1
011
000
59  
60 131 ▶ if(my $plan = $f->{plan}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $plan = $f->{"plan"}) 125 6 131
61 125 ▶ my $trace = $f->{trace} or die "Missing Trace!";
Branch: 1 branch
BranchTrueFalseTotal
my $trace = $f->{"trace"} or die "Missing Trace!" 125 0 125
62 return if $plan->{skip}
63 125 ▶ && ($trace->{pid} != $$ || $trace->{tid} != get_tid);
Branch: 1 branch
BranchTrueFalseTotal
if $plan->{"skip"} and $trace->{"pid"} != $$ || $trace->{"tid"} != 0 117 8 125
Condition66%4/6
$plan->{"skip"} and $trace->{"pid"} != $$ || $trace->{"tid"} != 0
!ll&&!rl&&r
08117
$trace->{"pid"} != $$ or $trace->{"tid"} != 0
l!l&&r!l&&!r
11708
MC/DC33%1/3
$plan->{"skip"} and $trace->{"pid"} != $$ || $trace->{"tid"} != 0
$plan->{"skip"} $trace->{"pid"} != $$ $trace->{"tid"} != 0
Truth table50%2/4
A and B or C
A= $plan->{"skip"}B= $trace->{"pid"} != $$C= $trace->{"tid"} != 0
ABCresult
0XX0
1000
11X1
1011
64 }
65  
66 455 ▶ no warnings 'exiting';
Subroutine BEGIN: called CC=1 SCAR=0.0
67 14 last T2_SUBTEST_WRAPPER;
68 }
69  
70 455 1;
71  
72 __END__
« blib/lib/Test2/Event/Plan.pm ↑ Summary blib/lib/Test/Builder/Formatter.pm »