blib/lib/Test2/AsyncSubtest/Hub.pm

filter: Statementstmt 86.0% 43 / 50 Branchbran 77.2% 17 / 22 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 88.8% 8 / 9 Podpod 25.0% 1 / 4 totaltotal 80.0% 72 / 90 CC 13 SCAR 14.8
CC
13
Cov
83%
send
7.0
inherit
5.0
init
4.1
CRAP 4.4
« blib/lib/Test2/Plugin/UTF8.pm ↑ Summary blib/lib/Test2/Util/Guard.pm »
1 package Test2::AsyncSubtest::Hub;
2 72 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 72 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 72 our $VERSION = '1.302226';
6  
7 72 ▶use base 'Test2::Hub::Subtest';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 72 ▶use Test2::Util::HashBase qw/ast_ids ast/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 72 ▶use Test2::Util qw/get_tid/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 72 my $NO_WARN_FOR_PLAN = 0;
12  
13 0 ▶sub do_not_warn_on_plan { $NO_WARN_FOR_PLAN = 1 };
Subroutine do_not_warn_on_plan: not called CC=1 SCAR=6.9
Pod undocumented
14  
15 511 ▶sub init {
Subroutine init: called CC=4 SCAR=14.1
Pod undocumented
16 511 my $self = shift;
17  
18 511 $self->SUPER::init();
19  
20 511 ▶ if (my $format = $self->format) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $format = $self->format) 133 378 511
21 133 ▶ my $hide = $format->can('hide_buffered') ? $format->hide_buffered : 1;
Branch: 1 branch
BranchTrueFalseTotal
$format->can('hide_buffered') ? : 133 0 133
22 133 ▶ $self->format(undef) if $hide;
Branch: 1 branch
BranchTrueFalseTotal
if $hide 133 0 133
23 }
24 }
25  
26 253 ▶sub inherit {
Subroutine inherit: called CC=4 SCAR=16.1
Pod undocumented
27 253 my $self = shift;
28 253 my ($from, %params) = @_;
29  
30 253 ▶ if (my $ls = $from->{+_LISTENERS}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $ls = $from->{"_listeners"}) 182 71 253
31 182 push @{$self->{+_LISTENERS}} => grep { $_->{inherit} } @$ls;
32 }
33  
34 253 ▶ if (my $pfs = $from->{+_PRE_FILTERS}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $pfs = $from->{"_pre_filters"}) 0 253 253
35 0 push @{$self->{+_PRE_FILTERS}} => grep { $_->{inherit} } @$pfs;
36 }
37  
38 253 ▶ if (my $fs = $from->{+_FILTERS}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $fs = $from->{"_filters"}) 0 253 253
39 0 push @{$self->{+_FILTERS}} => grep { $_->{inherit} } @$fs;
40 }
41 }
42  
43 1460 ▶sub send {
Subroutine send: called CC=7 SCAR=19.5
Pod documented
44 1460 my $self = shift;
45 1460 my ($e) = @_;
46  
47 1460 ▶ unless ($NO_WARN_FOR_PLAN) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($NO_WARN_FOR_PLAN) 1460 0 1460
48 1460 ▶ if (my $ast = $self->ast) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $ast = $self->ast) 1456 4 1460
49 1456 ▶ if ($$ != $ast->pid || get_tid != $ast->tid) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$ != $ast->pid or 0 != $ast->tid) 164 1292 1456
Condition66%2/3
$$ != $ast->pid or 0 != $ast->tid
l!l&&r!l&&!r
16401292
MC/DC50%1/2
$$ != $ast->pid or 0 != $ast->tid
$$ != $ast->pid 0 != $ast->tid
Truth table66%2/3
A or B
A= $$ != $ast->pidB= 0 != $ast->tid
ABresult
1X1
011
000
50 164 ▶ if (my $plan = $e->facet_data->{plan}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $plan = $e->facet_data->{"plan"}) 18 146 164
51 18 ▶ unless ($plan->{skip}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($plan->{"skip"}) 1 17 18
52 1 my $trace = $e->facet_data->{trace};
53 1 bless($trace, 'Test2::EventFacet::Trace');
54 1 $trace->alert("A plan should not be set inside an async-subtest (did you call done_testing()?)");
55 1 return;
56 }
57 }
58 }
59 }
60 }
61  
62 1459 return $self->SUPER::send($e);
63 }
64  
65 72 1;
66  
67 __END__
« blib/lib/Test2/Plugin/UTF8.pm ↑ Summary blib/lib/Test2/Util/Guard.pm »