blib/lib/Test/Builder.pm

filter: Statementstmt 95.3% 925 / 970 Branchbran 83.1% 369 / 444 Conditioncond 69.6% 177 / 254 MC/DCmcdc 49.6% 75 / 151 Subroutinesub 97.6% 123 / 126 Podpod 90.5% 48 / 53 totaltotal 85.9% 1717 / 1998 CC 319 SCAR 23.8
CC
319
Cov
88%
_ending
54.7
skip_all
41.0
_print_comment
30.0
CRAP 10.8
« blib/lib/Test2/API/Breakage.pm ↑ Summary blib/lib/Test2/AsyncSubtest.pm »
1 package Test::Builder;
2  
3 199 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 198 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 195 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 183 our $VERSION = '1.302226';
8  
9 194 ▶use Scalar::Util qw/blessed reftype weaken/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 192 ▶use Test2::Util qw/USE_THREADS try get_tid/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 191 ▶use Test2::API qw/context release/;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 # Make Test::Builder thread-safe for ithreads.
14 195 ▶BEGIN {
Subroutine BEGIN: called CC=3 SCAR=11.1
15 191 ▶ warn "Test::Builder was loaded after Test2 initialization, this is not recommended."
Branch: 1 branch
BranchTrueFalseTotal
if Test2::API::test2_init_done() or Test2::API::test2_load_done() 2 181 183
Condition66%2/3
Test2::API::test2_init_done() or Test2::API::test2_load_done()
l!l&&r!l&&!r
20181
MC/DC50%1/2
Test2::API::test2_init_done() or Test2::API::test2_load_done()
Test2::API::test2_init_done() Test2::API::test2_load_done()
Truth table66%2/3
A or B
A= Test2::API::test2_init_done()B= Test2::API::test2_load_done()
ABresult
1X1
011
000
16 if Test2::API::test2_init_done() || Test2::API::test2_load_done();
17  
18 191 if (USE_THREADS && ! Test2::API::test2_ipc_disabled()) {
19 require Test2::IPC;
20 require Test2::IPC::Driver::Files;
21 Test2::IPC::Driver::Files->import;
22 Test2::API::test2_ipc_enable_polling();
23 Test2::API::test2_no_wait(1);
24 }
25 }
26  
27 191 ▶use Test2::Event::Subtest;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 190 ▶use Test2::Hub::Subtest;
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 190 ▶use Test::Builder::Formatter;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 190 ▶use Test::Builder::TodoDiag;
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 183 our $Level = 1;
34 183 ▶our $Test = $ENV{TB_NO_EARLY_INIT} ? undef : Test::Builder->new;
Branch: 1 branch
BranchTrueFalseTotal
$ENV{'TB_NO_EARLY_INIT'} ? : 0 183 183
35  
36 392 ▶sub _add_ts_hooks {
Subroutine _add_ts_hooks: called CC=1 SCAR=0.0
37 385 my $self = shift;
38  
39 385 my $hub = $self->{Stack}->top;
40  
41 # Take a reference to the hash key, we do this to avoid closing over $self
42 # which is the singleton. We use a reference because the value could change
43 # in rare cases.
44 385 my $epkgr = \$self->{Exported_To};
45  
46 #$hub->add_context_aquire(sub {$_[0]->{level} += $Level - 1});
47  
48 $hub->pre_filter(
49 4628 ▶ sub {
Subroutine __ANON__: called CC=13 SCAR=25.7
50 4622 my ($active_hub, $e) = @_;
51  
52 4622 my $epkg = $$epkgr;
53 4622 ▶ my $cpkg = $e->{trace} ? $e->{trace}->{frame}->[0] : undef;
Branch: 1 branch
BranchTrueFalseTotal
$e->{'trace'} ? : 4622 0 4622
54  
55 190 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
56 190 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
57 4622 my $todo;
58 4622 ▶ $todo = ${"$cpkg\::TODO"} if $cpkg;
Branch: 1 branch
BranchTrueFalseTotal
if $cpkg 4622 0 4622
59 4622 ▶ $todo = ${"$epkg\::TODO"} if $epkg && !$todo;
Branch: 1 branch
BranchTrueFalseTotal
if $epkg and not $todo 3118 1504 4622
Condition100%3/3
$epkg and not $todo
!ll&&!rl&&r
12262783118
MC/DC100%2/2
$epkg and not $todo
$epkg not $todo
Truth table100%3/3
A and not(B)
A= $epkgB= not $todo
ABresult
0X0
100
111
60  
61 4622 ▶ return $e unless defined($todo);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $todo 4296 326 4622
62 326 ▶ return $e unless length($todo);
Branch: 1 branch
BranchTrueFalseTotal
unless length $todo 2 324 326
63  
64 # Turn a diag into a todo diag
65 324 ▶ return Test::Builder::TodoDiag->new(%$e) if ref($e) eq 'Test2::Event::Diag';
Branch: 1 branch
BranchTrueFalseTotal
if ref $e eq "Test2::Event::Diag" 115 209 324
66  
67 209 ▶ $e->set_todo($todo) if $e->can('set_todo');
Branch: 1 branch
BranchTrueFalseTotal
if $e->can("set_todo") 134 75 209
68 209 $e->add_amnesty({tag => 'TODO', details => $todo});
69  
70 # Set todo on ok's
71 209 ▶ if ($e->isa('Test2::Event::Ok')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e->isa("Test2::Event::Ok")) 134 75 209
72 134 $e->set_effective_pass(1);
73  
74 134 ▶ if (my $result = $e->get_meta(__PACKAGE__)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $result = $e->get_meta(__PACKAGE__)) 131 3 134
75 131 ▶ $result->{reason} ||= $todo;
Condition100%3/3
$result->{"reason"} ||= $todo
l!l&&r!l&&!r
261032
MC/DC100%2/2
$result->{"reason"} ||= $todo
$result->{"reason"} $todo
Truth table100%3/3
A ||= B
A= $result->{"reason"}B= $todo
ABresult
1X1
011
000
76 131 ▶ $result->{type} ||= 'todo';
Condition100%2/2
$result->{"type"} ||= "todo"
l!l
26105
MC/DC100%1/1
$result->{"type"} ||= "todo"
$result->{"type"}
Truth table100%2/2
A
A= $result->{"type"}
Aresult
11
00
77 131 $result->{ok} = 1;
78 }
79 }
80  
81 209 return $e;
82 },
83  
84 inherit => 1,
85  
86 intercept_inherit => {
87 33 ▶ clean => sub {
Subroutine __ANON__: called CC=5 SCAR=16.1
88 27 my %params = @_;
89  
90 27 my $state = $params{state};
91 27 my $trace = $params{trace};
92  
93 27 my $epkg = $$epkgr;
94 27 my $cpkg = $trace->{frame}->[0];
95  
96 189 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
97 184 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 27 $state->{+__PACKAGE__} = {};
100 27 ▶ $state->{+__PACKAGE__}->{"$cpkg\::TODO"} = ${"$cpkg\::TODO"} if $cpkg;
Branch: 1 branch
BranchTrueFalseTotal
if $cpkg 27 0 27
101 27 ▶ $state->{+__PACKAGE__}->{"$epkg\::TODO"} = ${"$epkg\::TODO"} if $epkg;
Branch: 1 branch
BranchTrueFalseTotal
if $epkg 17 10 27
102  
103 27 ▶ ${"$cpkg\::TODO"} = undef if $cpkg;
Branch: 1 branch
BranchTrueFalseTotal
if $cpkg 27 0 27
104 27 ▶ ${"$epkg\::TODO"} = undef if $epkg;
Branch: 1 branch
BranchTrueFalseTotal
if $epkg 17 10 27
105 },
106 35 ▶ restore => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
107 29 my %params = @_;
108 29 my $state = $params{state};
109  
110 184 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
111 184 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
112  
113 29 for my $item (keys %{$state->{+__PACKAGE__}}) {
114 184 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
115 184 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
116  
117 29 ${"$item"} = $state->{+__PACKAGE__}->{$item};
118 }
119 },
120 },
121 385 );
122 }
123  
124 {
125 184 ▶ no warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
126 157 ▶ INIT {
Subroutine INIT: called CC=2 SCAR=6.9
127 184 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
128 150 ▶ Test2::API::test2_load() unless Test2::API::test2_in_preload();
Branch: 1 branch
BranchTrueFalseTotal
unless Test2::API::test2_in_preload() 149 1 150
129 }
130 }
131  
132 183 ▶sub new {
Subroutine new: called CC=3 SCAR=11.1
Pod documented
133 2288 my($class) = shift;
134 2288 ▶ unless($Test) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($Test::Builder::Test) 183 2105 2288
135 183 $Test = $class->create(singleton => 1);
136  
137 Test2::API::test2_add_callback_post_load(
138 178 ▶ sub {
Subroutine __ANON__: called CC=3 SCAR=12.5
139 177 ▶ $Test->{Original_Pid} = $$ if !$Test->{Original_Pid} || $Test->{Original_Pid} == 0;
Branch: 1 branch
BranchTrueFalseTotal
if not $Test::Builder::Test->{"Original_Pid"} or $Test::Builder::Test->{"Original_Pid"} == 0 177 0 177
Condition33%1/3
not $Test::Builder::Test->{"Original_Pid"} or $Test::Builder::Test->{"Original_Pid"} == 0
l!l&&r!l&&!r
17700
MC/DC0%0/2
not $Test::Builder::Test->{"Original_Pid"} or $Test::Builder::Test->{"Original_Pid"} == 0
not $Test::Builder::Test->{"Original_Pid"} $Test::Builder::Test->{"Original_Pid"} == 0
Truth table33%1/3
not(A) or B
A= not $Test::Builder::Test->{"Original_Pid"}B= $Test::Builder::Test->{"Original_Pid"} == 0
ABresult
1X1
011
000
140 177 $Test->reset(singleton => 1);
141 177 $Test->_add_ts_hooks;
142 }
143 183 );
144  
145 # Non-TB tools normally expect 0 added to the level. $Level is normally 1. So
146 # we only want the level to change if $Level != 1.
147 # TB->ctx compensates for this later.
148 183 ▶ Test2::API::test2_add_callback_context_aquire(sub { $_[0]->{level} += $Level - 1 });
Subroutine __ANON__: called CC=1 SCAR=0.0
149  
150 183 ▶ Test2::API::test2_add_callback_exit(sub { $Test->_ending(@_) });
Subroutine __ANON__: called CC=1 SCAR=0.0
151  
152 183 ▶ Test2::API::test2_ipc()->set_no_fatal(1) if Test2::API::test2_has_ipc();
Branch: 1 branch
BranchTrueFalseTotal
if Test2::API::test2_has_ipc() 0 183 183
153 }
154 2288 return $Test;
155 }
156  
157 231 ▶sub create {
Subroutine create: called CC=2 SCAR=6.9
Pod documented
158 230 my $class = shift;
159 230 my %params = @_;
160  
161 230 my $self = bless {}, $class;
162 230 ▶ if ($params{singleton}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params{'singleton'}) { } 183 47 230
163 183 $self->{Stack} = Test2::API::test2_stack();
164 }
165 else {
166 47 $self->{Stack} = Test2::API::Stack->new;
167 $self->{Stack}->new_hub(
168 47 formatter => Test::Builder::Formatter->new,
169 ipc => Test2::API::test2_ipc(),
170 );
171  
172 47 $self->reset(%params);
173 47 $self->_add_ts_hooks;
174 }
175  
176 230 return $self;
177 }
178  
179 11181 ▶sub ctx {
Subroutine ctx: called CC=1 SCAR=0.0
Pod undocumented
180 11180 my $self = shift;
181 context(
182 # 1 for our frame, another for the -1 off of $Level in our hook at the top.
183 level => 2,
184 fudge => 1,
185 stack => $self->{Stack},
186 hub => $self->{Hub},
187 11180 wrapped => 1,
188 @_
189 );
190 }
191  
192 153 ▶sub parent {
Subroutine parent: called CC=3 SCAR=11.0
Pod undocumented
193 152 my $self = shift;
194 152 my $ctx = $self->ctx;
195 152 ▶ my $chub = $self->{Hub} || $ctx->hub;
Condition66%2/3
$self->{'Hub'} || $ctx->hub
l!l&&r!l&&!r
15110
MC/DC0%0/2
$self->{'Hub'} || $ctx->hub
$self->{'Hub'} $ctx->hub
Truth table66%2/3
A || B
A= $self->{'Hub'}B= $ctx->hub
ABresult
1X1
011
000
196 152 $ctx->release;
197  
198 152 my $meta = $chub->meta(__PACKAGE__, {});
199 152 my $parent = $meta->{parent};
200  
201 152 ▶ return undef unless $parent;
Branch: 1 branch
BranchTrueFalseTotal
unless $parent 1 151 152
202  
203 return bless {
204 Original_Pid => $$,
205 Stack => $self->{Stack},
206 151 Hub => $parent,
207 }, blessed($self);
208 }
209  
210 156 ▶sub child {
Subroutine child: called CC=5 SCAR=16.1
Pod undocumented
211 155 my( $self, $name ) = @_;
212  
213 155 ▶ $name ||= "Child of " . $self->name;
Condition100%2/2
$name ||= 'Child of ' . $self->name
l!l
1505
MC/DC100%1/1
$name ||= 'Child of ' . $self->name
$name
Truth table100%2/2
A
A= $name
Aresult
11
00
214 155 my $ctx = $self->ctx;
215  
216 155 my $parent = $ctx->hub;
217 155 my $pmeta = $parent->meta(__PACKAGE__, {});
218 $self->croak("You already have a child named ($pmeta->{child}) running")
219 155 ▶ if $pmeta->{child};
Branch: 1 branch
BranchTrueFalseTotal
if $pmeta->{"child"} 0 155 155
220  
221 155 $pmeta->{child} = $name;
222  
223 # Clear $TODO for the child.
224 155 my $orig_TODO = $self->find_TODO(undef, 1, undef);
225  
226 155 my $subevents = [];
227  
228 155 my $hub = $ctx->stack->new_hub(
229 class => 'Test2::Hub::Subtest',
230 );
231  
232 115 ▶ $hub->pre_filter(sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
233 114 my ($active_hub, $e) = @_;
234  
235 # Turn a diag into a todo diag
236 114 ▶ return Test::Builder::TodoDiag->new(%$e) if ref($e) eq 'Test2::Event::Diag';
Branch: 1 branch
BranchTrueFalseTotal
if ref $e eq "Test2::Event::Diag" 36 78 114
237  
238 78 return $e;
239 155 ▶ }, inherit => 1) if $orig_TODO;
Branch: 1 branch
BranchTrueFalseTotal
if $orig_TODO 25 130 155
240  
241 155 ▶ $hub->listen(sub { push @$subevents => $_[1] });
Subroutine __ANON__: called CC=1 SCAR=0.0
242  
243 155 $hub->set_nested( $parent->nested + 1 );
244  
245 155 my $meta = $hub->meta(__PACKAGE__, {});
246 155 $meta->{Name} = $name;
247 155 $meta->{TODO} = $orig_TODO;
248 155 $meta->{TODO_PKG} = $ctx->trace->package;
249 155 $meta->{parent} = $parent;
250 155 $meta->{Test_Results} = [];
251 155 $meta->{subevents} = $subevents;
252 155 $meta->{subtest_id} = $hub->id;
253 155 $meta->{subtest_uuid} = $hub->uuid;
254 155 ▶ $meta->{subtest_buffered} = $parent->format ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$parent->format ? : 145 10 155
255  
256 155 $self->_add_ts_hooks;
257  
258 155 $ctx->release;
259 155 return bless { Original_Pid => $$, Stack => $self->{Stack}, Hub => $hub, no_log_results => $self->{no_log_results} }, blessed($self);
260 }
261  
262 152 ▶sub finalize {
Subroutine finalize: called CC=24 SCAR=31.9
Pod undocumented
263 151 my $self = shift;
264 151 my $end_hub = 1;
265 151 ▶ ($end_hub) = @_ if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 151 151
266  
267 151 my $st_ctx = $self->ctx;
268 151 ▶ my $chub = $self->{Hub} || return $st_ctx->release;
Condition50%1/2
$self->{'Hub'} || (return $st_ctx->release)
l!l
1510
MC/DC0%0/1
$self->{'Hub'} || (return $st_ctx->release)
$self->{'Hub'}
Truth table50%1/2
A
A= $self->{'Hub'}
Aresult
11
00
269  
270 151 my $meta = $chub->meta(__PACKAGE__, {});
271 151 ▶ if ($meta->{child}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($meta->{"child"}) 0 151 151
272 0 $self->croak("Can't call finalize() with child ($meta->{child}) active");
273 }
274  
275 151 local $? = 0; # don't fail if $subtests happened to set $? nonzero
276  
277 151 $self->{Stack}->pop($chub);
278  
279 151 $self->find_TODO($meta->{TODO_PKG}, 1, $meta->{TODO});
280  
281 151 my $parent = $self->parent;
282 151 my $ctx = $parent->ctx;
283 151 my $trace = $ctx->trace;
284 151 delete $ctx->hub->meta(__PACKAGE__, {})->{child};
285  
286 151 ▶ $chub->finalize($trace->snapshot(hid => $chub->hid, nested => $chub->nested), 1)
Branch: 1 branch
BranchTrueFalseTotal
if $end_hub and $chub->count and not $chub->no_ending and not $chub->ended 89 62 151
Condition88%8/9
$end_hub and $chub->count and not $chub->no_ending and not $chub->ended
!ll&&!rl&&r
59389
$end_hub and $chub->count and not $chub->no_ending
!ll&&!rl&&r
58192
$end_hub and $chub->count
!ll&&!rl&&r
05893
MC/DC75%3/4
$end_hub and $chub->count and not $chub->no_ending and not $chub->ended
$end_hub $chub->count not $chub->no_ending not $chub->ended
Truth table80%4/5
A and B and not(C) and not(D)
A= $end_hubB= $chub->countC= not $chub->no_endingD= not $chub->ended
ABCDresult
0XXX0
10XX0
110X0
11100
11111
287 if $end_hub
288 && $chub->count
289 && !$chub->no_ending
290 && !$chub->ended;
291  
292 151 ▶ my $plan = $chub->plan || 0;
Condition100%2/2
$chub->plan || 0
l!l
12031
MC/DC100%1/1
$chub->plan || 0
$chub->plan
Truth table100%2/2
A
A= $chub->plan
Aresult
11
00
293 151 my $count = $chub->count;
294 151 my $failed = $chub->failed;
295 151 my $passed = $chub->is_passing;
296  
297 151 ▶ my $num_extra = $plan =~ m/\D/ ? 0 : $count - $plan;
Branch: 1 branch
BranchTrueFalseTotal
$plan =~ /\D/ ? : 15 136 151
298 151 ▶ if ($count && $num_extra != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($count and $num_extra != 0) 12 139 151
Condition100%3/3
$count and $num_extra != 0
!ll&&!rl&&r
588112
MC/DC100%2/2
$count and $num_extra != 0
$count $num_extra != 0
Truth table100%3/3
A and B
A= $countB= $num_extra != 0
ABresult
0X0
100
111
299 12 ▶ my $s = $plan == 1 ? '' : 's';
Branch: 1 branch
BranchTrueFalseTotal
$plan == 1 ? : 0 12 12
300 12 $st_ctx->diag(<<"FAIL");
301 Looks like you planned $plan test$s but ran $count.
302 FAIL
303 }
304  
305 151 ▶ if ($failed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($failed) 61 90 151
306 61 ▶ my $s = $failed == 1 ? '' : 's';
Branch: 1 branch
BranchTrueFalseTotal
$failed == 1 ? : 49 12 61
307  
308 61 ▶ my $qualifier = $num_extra == 0 ? '' : ' run';
Branch: 1 branch
BranchTrueFalseTotal
$num_extra == 0 ? : 49 12 61
309  
310 61 $st_ctx->diag(<<"FAIL");
311 Looks like you failed $failed test$s of $count$qualifier.
312 FAIL
313 }
314  
315 151 ▶ if (!$passed && !$failed && $count && !$num_extra) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $passed || $failed and $count and not $num_extra) 1 150 151
Condition88%8/9
not $passed || $failed and $count and not $num_extra
!ll&&!rl&&r
15001
not $passed || $failed and $count
!ll&&!rl&&r
135151
$passed || $failed
l!l&&r!l&&!r
746116
MC/DC75%3/4
not $passed || $failed and $count and not $num_extra
$passed $failed $count not $num_extra
Truth table80%4/5
not(A || B) and C and not(D)
A= $passedB= $failedC= $countD= not $num_extra
ABCDresult
1XXX0
01XX0
000X0
00100
00111
316 1 $st_ctx->diag(<<"FAIL");
317 All assertions inside the subtest passed, but errors were encountered.
318 FAIL
319 }
320  
321 151 $st_ctx->release;
322  
323 151 ▶ unless ($chub->bailed_out) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($chub->bailed_out) 151 0 151
324 151 my $plan = $chub->plan;
325 151 ▶ if ( $plan && $plan eq 'SKIP' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($plan and $plan eq 'SKIP') { } 3 148 151
elsif (not $chub->count) { } 55 93 148
Condition100%3/3
$plan and $plan eq "SKIP"
!ll&&!rl&&r
311173
MC/DC100%2/2
$plan and $plan eq "SKIP"
$plan $plan eq "SKIP"
Truth table100%3/3
A and B
A= $planB= $plan eq "SKIP"
ABresult
0X0
100
111
326 3 $parent->skip($chub->skip_reason, $meta->{Name});
327 }
328 elsif ( !$chub->count ) {
329 55 $parent->ok( 0, sprintf q[No tests run for subtest "%s"], $meta->{Name} );
330 }
331 else {
332 93 $parent->{subevents} = $meta->{subevents};
333 93 $parent->{subtest_id} = $meta->{subtest_id};
334 93 $parent->{subtest_uuid} = $meta->{subtest_uuid};
335 93 $parent->{subtest_buffered} = $meta->{subtest_buffered};
336 93 $parent->ok( $chub->is_passing, $meta->{Name} );
337 }
338 }
339  
340 151 $ctx->release;
341 151 return $chub->is_passing;
342 }
343  
344 147 ▶sub subtest {
Subroutine subtest: called CC=23 SCAR=32.9
Pod documented
345 146 my $self = shift;
346 146 my ($name, $code, @args) = @_;
347 146 my $ctx = $self->ctx;
348 146 ▶ $ctx->throw("subtest()'s second argument must be a code ref")
Branch: 1 branch
BranchTrueFalseTotal
unless $code and builtin::reftype($code) eq "CODE" 2 144 146
Condition66%2/3
$code and builtin::reftype($code) eq "CODE"
!ll&&!rl&&r
20144
MC/DC50%1/2
$code and builtin::reftype($code) eq "CODE"
$code builtin::reftype($code) eq "CODE"
Truth table66%2/3
A and B
A= $codeB= builtin::reftype($code) eq "CODE"
ABresult
0X0
100
111
349 unless $code && reftype($code) eq 'CODE';
350  
351 144 ▶ $name ||= "Child of " . $self->name;
Condition50%1/2
$name ||= 'Child of ' . $self->name
l!l
1440
MC/DC0%0/1
$name ||= 'Child of ' . $self->name
$name
Truth table50%1/2
A
A= $name
Aresult
11
00
352  
353  
354 $_->($name,$code,@args)
355 144 for Test2::API::test2_list_pre_subtest_callbacks();
356  
357 144 $ctx->note("Subtest: $name");
358  
359 144 my $child = $self->child($name);
360  
361 144 my $start_pid = $$;
362 144 my $st_ctx;
363 144 my ($ok, $err, $finished, $child_error);
364 T2_SUBTEST_WRAPPER: {
365 144 my $ctx = $self->ctx;
366 144 $st_ctx = $ctx->snapshot;
367 144 $ctx->release;
368 144 $ok = eval { local $Level = 1; $code->(@args); 1 };
369 138 ($err, $child_error) = ($@, $?);
370  
371 # They might have done 'BEGIN { skip_all => "whatever" }'
372 138 ▶ if (!$ok && $err =~ m/Label not found for "last T2_SUBTEST_WRAPPER"/ || (blessed($err) && blessed($err) eq 'Test::Builder::Exception')) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $ok and $err =~ /Label not found for "last T2_SUBTEST_WRAPPER"/ or builtin::blessed($err) and builtin::blessed($err) eq 'Test::Builder::Exception') { } 0 138 138
Condition44%4/9
not $ok and $err =~ /Label not found for "last T2_SUBTEST_WRAPPER"/ or builtin::blessed($err) and builtin::blessed($err) eq "Test::Builder::Exception"
l!l&&r!l&&!r
00138
not $ok and $err =~ /Label not found for "last T2_SUBTEST_WRAPPER"/
!ll&&!rl&&r
13530
builtin::blessed($err) and builtin::blessed($err) eq "Test::Builder::Exception"
!ll&&!rl&&r
13800
MC/DC0%0/4
not $ok and $err =~ /Label not found for "last T2_SUBTEST_WRAPPER"/ or builtin::blessed($err) and builtin::blessed($err) eq "Test::Builder::Exception"
not $ok $err =~ /Label not found for "last T2_SUBTEST_WRAPPER"/ builtin::blessed($err) builtin::blessed($err) eq "Test::Builder::Exception"
Truth table28%2/7
not(A) and B or C and D
A= not $okB= $err =~ /Label not found for "last T2_SUBTEST_WRAPPER"/C= builtin::blessed($err)D= builtin::blessed($err) eq "Test::Builder::Exception"
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
373 0 $ok = undef;
374 0 $err = undef;
375 }
376 else {
377 138 $finished = 1;
378 }
379 }
380  
381 143 ▶ if ($start_pid != $$ && !$INC{'Test2/IPC.pm'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($start_pid != $$ and not $INC{"Test2/IPC.pm"}) 0 143 143
Condition33%1/3
$start_pid != $$ and not $INC{"Test2/IPC.pm"}
!ll&&!rl&&r
14300
MC/DC0%0/2
$start_pid != $$ and not $INC{"Test2/IPC.pm"}
$start_pid != $$ not $INC{"Test2/IPC.pm"}
Truth table33%1/3
A and not(B)
A= $start_pid != $$B= not $INC{"Test2/IPC.pm"}
ABresult
0X0
100
111
382 0 ▶ warn $ok ? "Forked inside subtest, but subtest never finished!\n" : $err;
Branch: 1 branch
BranchTrueFalseTotal
$ok ? : 0 0 0
383 0 exit 255;
384 }
385  
386 143 my $trace = $ctx->trace;
387  
388 143 ▶ if (!$finished) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($finished) 5 138 143
389 5 ▶ if(my $bailed = $st_ctx->hub->bailed_out) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $bailed = $st_ctx->hub->bailed_out) 2 3 5
390 2 my $chub = $child->{Hub};
391 2 $self->{Stack}->pop($chub);
392 2 $ctx->bail($bailed->reason);
393 }
394 3 my $code = $st_ctx->hub->exit_code;
395 3 $ok = !$code;
396 3 ▶ $err = "Subtest ended with exit code $code" if $code;
Branch: 1 branch
BranchTrueFalseTotal
if $code 0 3 3
397 }
398  
399 # Record the exception inside the subtest so it fails and says why. The
400 # exception is still rethrown below, this only stops the subtest reporting
401 # success for code that never finished.
402 141 ▶ $st_ctx->send_event('Exception', error => $err)
Branch: 1 branch
BranchTrueFalseTotal
if not $ok and defined $err 3 138 141
Condition66%2/3
not $ok and defined $err
!ll&&!rl&&r
13803
MC/DC50%1/2
not $ok and defined $err
not $ok defined $err
Truth table66%2/3
not(A) and B
A= not $okB= defined $err
ABresult
0X0
100
111
403 if !$ok && defined($err);
404  
405 141 my $st_hub = $st_ctx->hub;
406 141 my $plan = $st_hub->plan;
407 141 my $count = $st_hub->count;
408  
409 141 ▶ if (!$count && (!defined($plan) || "$plan" ne 'SKIP')) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $count and !defined($plan) || "$plan" ne "SKIP") 51 90 141
Condition100%6/6
not $count and !defined($plan) || "$plan" ne "SKIP"
!ll&&!rl&&r
87351
not defined $plan or "$plan" ne "SKIP"
l!l&&r!l&&!r
14373
MC/DC100%3/3
not $count and !defined($plan) || "$plan" ne "SKIP"
not $count not defined $plan "$plan" ne "SKIP"
Truth table100%4/4
not(A) and not(B) or C
A= not $countB= not defined $planC= "$plan" ne "SKIP"
ABCresult
0XX0
1000
11X1
1011
410 51 ▶ $st_ctx->plan(0) unless defined $plan;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $plan 14 37 51
411 51 $st_ctx->diag('No tests run!');
412 }
413  
414 141 $child->finalize;
415  
416 141 $ctx->release;
417  
418 141 ▶ die $err unless $ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 3 138 141
419  
420 138 ▶ $? = $child_error if defined $child_error;
Branch: 1 branch
BranchTrueFalseTotal
if defined $child_error 135 3 138
421  
422 138 return $st_hub->is_passing;
423 }
424  
425 7 ▶sub name {
Subroutine name: called CC=1 SCAR=0.0
Pod documented
426 6 my $self = shift;
427 6 my $ctx = $self->ctx;
428 6 release $ctx, $ctx->hub->meta(__PACKAGE__, {})->{Name};
429 }
430  
431 238 ▶sub reset { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
Subroutine reset: called CC=12 SCAR=24.9
Pod documented
432 237 my ($self, %params) = @_;
433  
434 237 Test2::API::test2_unset_is_end();
435  
436 # We leave this a global because it has to be localized and localizing
437 # hash keys is just asking for pain. Also, it was documented.
438 237 $Level = 1;
439  
440 $self->{no_log_results} = $ENV{TEST_NO_LOG_RESULTS} ? 1 : 0
441 237 ▶ unless $params{singleton};
Branch: 2 branches
BranchTrueFalseTotal
unless $params{"singleton"} 55 182 237
$ENV{'TEST_NO_LOG_RESULTS'} ? : 0 55 55
442  
443 237 ▶ $self->{Original_Pid} = Test2::API::test2_in_preload() ? -1 : $$;
Branch: 1 branch
BranchTrueFalseTotal
Test2::API::test2_in_preload() ? : 0 237 237
444  
445 237 my $ctx = $self->ctx;
446 237 my $hub = $ctx->hub;
447 237 $ctx->release;
448 237 ▶ unless ($params{singleton}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($params{"singleton"}) 55 182 237
449 55 $hub->reset_state();
450 55 $hub->_tb_reset();
451 }
452  
453 237 $ctx = $self->ctx;
454  
455 237 my $meta = $ctx->hub->meta(__PACKAGE__, {});
456 %$meta = (
457 Name => $0,
458 Ending => 0,
459 Done_Testing => undef,
460 Skip_All => 0,
461 Test_Results => [],
462 parent => $meta->{parent},
463 237 );
464  
465 237 ▶ $self->{Exported_To} = undef unless $params{singleton};
Branch: 1 branch
BranchTrueFalseTotal
unless $params{"singleton"} 55 182 237
466  
467 237 ▶ $self->{Orig_Handles} ||= do {
Condition66%2/3
$self->{"Orig_Handles"} ||= do { my $format = $ctx->hub->format; my $out; if ($format and $format->isa("Test2::Formatter::TAP")) { $out = $format->handles; } ; $out ? [@$out] : [] }
l!l&&r!l&&!r
82290
MC/DC0%0/2
$self->{"Orig_Handles"} ||= do { my $format = $ctx->hub->format; my $out; if ($format and $format->isa("Test2::Formatter::TAP")) { $out = $format->handles; } ; $out ? [@$out] : [] }
$self->{"Orig_Handles"} do { my $format = $ctx->hub->format; my $out; if ($format and $format->isa("Test2::Formatter::TAP")) { $out = $format->handles; } ; $out ? [@$out] : [] }
Truth table66%2/3
A ||= B
A= $self->{"Orig_Handles"}B= do { my $format = $ctx->hub->format; my $out; if ($format and $format->isa("Test2::Formatter::TAP")) { $out = $format->handles; } ; $out ? [@$out] : [] }
ABresult
1X1
011
000
468 229 my $format = $ctx->hub->format;
469 229 my $out;
470 229 ▶ if ($format && $format->isa('Test2::Formatter::TAP')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($format and $format->isa("Test2::Formatter::TAP")) 228 1 229
Condition66%2/3
$format and $format->isa("Test2::Formatter::TAP")
!ll&&!rl&&r
10228
MC/DC50%1/2
$format and $format->isa("Test2::Formatter::TAP")
$format $format->isa("Test2::Formatter::TAP")
Truth table66%2/3
A and B
A= $formatB= $format->isa("Test2::Formatter::TAP")
ABresult
0X0
100
111
471 228 $out = $format->handles;
472 }
473 229 ▶ $out ? [@$out] : [];
Branch: 1 branch
BranchTrueFalseTotal
$out ? : 228 1 229
474 };
475  
476 237 $self->use_numbers(1);
477 237 ▶ $self->no_header(0) unless $params{singleton};
Branch: 1 branch
BranchTrueFalseTotal
unless $params{"singleton"} 55 182 237
478 237 ▶ $self->no_ending(0) unless $params{singleton};
Branch: 1 branch
BranchTrueFalseTotal
unless $params{"singleton"} 55 182 237
479 237 $self->reset_outputs;
480  
481 237 $ctx->release;
482  
483 237 return;
484 }
485  
486  
487 183 my %plan_cmds = (
488 no_plan => \&no_plan,
489 skip_all => \&skip_all,
490 tests => \&_plan_tests,
491 );
492  
493 298 ▶sub plan {
Subroutine plan: called CC=4 SCAR=13.9
Pod documented
494 297 my( $self, $cmd, $arg ) = @_;
495  
496 297 ▶ return unless $cmd;
Branch: 1 branch
BranchTrueFalseTotal
unless $cmd 77 220 297
497  
498 220 my $ctx = $self->ctx;
499 220 my $hub = $ctx->hub;
500  
501 220 ▶ $ctx->throw("You tried to plan twice") if $hub->plan;
Branch: 1 branch
BranchTrueFalseTotal
if $hub->plan 2 218 220
502  
503 218 local $Level = $Level + 1;
504  
505 218 ▶ if( my $method = $plan_cmds{$cmd} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $method = $plan_cmds{$cmd}) { } 215 3 218
506 215 local $Level = $Level + 1;
507 215 $self->$method($arg);
508 }
509 else {
510 3 my @args = grep { defined } ( $cmd, $arg );
511 3 $ctx->throw("plan() doesn't understand @args");
512 }
513  
514 196 release $ctx, 1;
515 }
516  
517  
518 178 ▶sub _plan_tests {
Subroutine _plan_tests: called CC=3 SCAR=11.0
519 177 my($self, $arg) = @_;
520  
521 177 my $ctx = $self->ctx;
522  
523 177 ▶ if($arg) {
Branch: 2 branches
BranchTrueFalseTotal
if ($arg) { } 174 3 177
elsif (not defined $arg) { } 1 2 3
524 174 local $Level = $Level + 1;
525 174 $self->expected_tests($arg);
526 }
527 elsif( !defined $arg ) {
528 1 $ctx->throw("Got an undefined number of tests");
529 }
530 else {
531 2 $ctx->throw("You said to run 0 tests");
532 }
533  
534 170 $ctx->release;
535 }
536  
537  
538 265 ▶sub expected_tests {
Subroutine expected_tests: called CC=5 SCAR=16.1
Pod documented
539 264 my $self = shift;
540 264 my($max) = @_;
541  
542 264 my $ctx = $self->ctx;
543  
544 264 ▶ if(@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 174 90 264
545 174 ▶ $self->croak("Number of tests must be a positive integer. You gave it '$max'")
Branch: 1 branch
BranchTrueFalseTotal
unless $max =~ /^\+?\d+$/ 4 170 174
546 unless $max =~ /^\+?\d+$/;
547  
548 170 $ctx->plan($max);
549 }
550  
551 260 my $hub = $ctx->hub;
552  
553 260 $ctx->release;
554  
555 260 my $plan = $hub->plan;
556 260 ▶ return 0 unless $plan;
Branch: 1 branch
BranchTrueFalseTotal
unless $plan 47 213 260
557 213 ▶ return 0 if $plan =~ m/\D/;
Branch: 1 branch
BranchTrueFalseTotal
if $plan =~ /\D/ 1 212 213
558 212 return $plan;
559 }
560  
561  
562 28 ▶sub no_plan {
Subroutine no_plan: called CC=3 SCAR=11.0
Pod documented
563 27 my($self, $arg) = @_;
564  
565 27 my $ctx = $self->ctx;
566  
567 27 ▶ if (defined $ctx->hub->plan) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ctx->hub->plan) 1 26 27
568 1 warn "Plan already set, no_plan() is a no-op, this will change to a hard failure in the future.";
569 1 $ctx->release;
570 1 return;
571 }
572  
573 26 ▶ $ctx->alert("no_plan takes no arguments") if $arg;
Branch: 1 branch
BranchTrueFalseTotal
if $arg 1 25 26
574  
575 26 $ctx->hub->plan('NO PLAN');
576  
577 26 release $ctx, 1;
578 }
579  
580  
581 70 ▶sub done_testing {
Subroutine done_testing: called CC=12 SCAR=25.0
Pod documented
582 69 my($self, $num_tests) = @_;
583  
584 69 my $ctx = $self->ctx;
585  
586 69 my $meta = $ctx->hub->meta(__PACKAGE__, {});
587  
588 69 ▶ if ($meta->{Done_Testing}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($meta->{"Done_Testing"}) 2 67 69
589 2 my ($file, $line) = @{$meta->{Done_Testing}}[1,2];
590 2 local $ctx->hub->{ended}; # OMG This is awful.
591 2 $self->ok(0, "done_testing() was already called at $file line $line");
592 2 $ctx->release;
593 2 return;
594 }
595 67 $meta->{Done_Testing} = [$ctx->trace->call];
596  
597 67 my $plan = $ctx->hub->plan;
598 67 my $count = $ctx->hub->count;
599  
600 # If done_testing() specified the number of tests, shut off no_plan
601 67 ▶ if( defined $num_tests ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $num_tests) { } 19 48 67
elsif ($count and defined $num_tests and $count != $num_tests) { } 0 48 48
602 19 ▶ $ctx->plan($num_tests) if !$plan || $plan eq 'NO PLAN';
Branch: 1 branch
BranchTrueFalseTotal
if not $plan or $plan eq "NO PLAN" 17 2 19
Condition100%3/3
not $plan or $plan eq "NO PLAN"
l!l&&r!l&&!r
1612
MC/DC100%2/2
not $plan or $plan eq "NO PLAN"
not $plan $plan eq "NO PLAN"
Truth table100%3/3
not(A) or B
A= not $planB= $plan eq "NO PLAN"
ABresult
1X1
011
000
603 }
604 ▶ elsif ($count && defined $num_tests && $count != $num_tests) {
Condition50%3/6
$count and defined $num_tests and $count != $num_tests
!ll&&!rl&&r
4800
$count and defined $num_tests
!ll&&!rl&&r
14340
MC/DC0%0/3
$count and defined $num_tests and $count != $num_tests
$count defined $num_tests $count != $num_tests
Truth table50%2/4
A and B and C
A= $countB= defined $num_testsC= $count != $num_tests
ABCresult
0XX0
10X0
1100
1111
605 0 $self->ok(0, "planned to run @{[ $self->expected_tests ]} but done_testing() expects $num_tests");
606 }
607 else {
608 48 $num_tests = $self->current_test;
609 }
610  
611 67 ▶ if( $self->expected_tests && $num_tests != $self->expected_tests ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->expected_tests and $num_tests != $self->expected_tests) 2 65 67
Condition100%3/3
$self->expected_tests and $num_tests != $self->expected_tests
!ll&&!rl&&r
47182
MC/DC100%2/2
$self->expected_tests and $num_tests != $self->expected_tests
$self->expected_tests $num_tests != $self->expected_tests
Truth table100%3/3
A and B
A= $self->expected_testsB= $num_tests != $self->expected_tests
ABresult
0X0
100
111
612 2 $self->ok(0, "planned to run @{[ $self->expected_tests ]} ".
613 "but done_testing() expects $num_tests");
614 }
615  
616 67 ▶ $ctx->plan($num_tests) if $ctx->hub->plan && $ctx->hub->plan eq 'NO PLAN';
Branch: 1 branch
BranchTrueFalseTotal
if $ctx->hub->plan and $ctx->hub->plan eq "NO PLAN" 1 66 67
Condition100%3/3
$ctx->hub->plan and $ctx->hub->plan eq "NO PLAN"
!ll&&!rl&&r
46201
MC/DC100%2/2
$ctx->hub->plan and $ctx->hub->plan eq "NO PLAN"
$ctx->hub->plan $ctx->hub->plan eq "NO PLAN"
Truth table100%3/3
A and B
A= $ctx->hub->planB= $ctx->hub->plan eq "NO PLAN"
ABresult
0X0
100
111
617  
618 67 $ctx->hub->finalize($ctx->trace, 1);
619  
620 67 release $ctx, 1;
621 }
622  
623  
624 12 ▶sub has_plan {
Subroutine has_plan: called CC=5 SCAR=16.1
Pod documented
625 11 my $self = shift;
626  
627 11 my $ctx = $self->ctx;
628 11 my $plan = $ctx->hub->plan;
629 11 $ctx->release;
630  
631 11 ▶ return( $plan ) if $plan && $plan !~ m/\D/;
Branch: 1 branch
BranchTrueFalseTotal
if $plan and not $plan =~ /\D/ 4 7 11
Condition100%3/3
$plan and not $plan =~ /\D/
!ll&&!rl&&r
254
MC/DC100%2/2
$plan and not $plan =~ /\D/
$plan not $plan =~ /\D/
Truth table100%3/3
A and not(B)
A= $planB= not $plan =~ /\D/
ABresult
0X0
100
111
632 7 ▶ return('no_plan') if $plan && $plan eq 'NO PLAN';
Branch: 1 branch
BranchTrueFalseTotal
if $plan and $plan eq "NO PLAN" 5 2 7
Condition66%2/3
$plan and $plan eq "NO PLAN"
!ll&&!rl&&r
205
MC/DC50%1/2
$plan and $plan eq "NO PLAN"
$plan $plan eq "NO PLAN"
Truth table66%2/3
A and B
A= $planB= $plan eq "NO PLAN"
ABresult
0X0
100
111
633 2 return(undef);
634 }
635  
636  
637 13 ▶sub skip_all {
Subroutine skip_all: called CC=10 SCAR=37.1
Pod documented
638 13 my( $self, $reason ) = @_;
639  
640 13 my $ctx = $self->ctx;
641  
642 13 ▶ $ctx->hub->meta(__PACKAGE__, {})->{Skip_All} = $reason || 1;
Condition100%2/2
$reason || 1
l!l
112
MC/DC100%1/1
$reason || 1
$reason
Truth table100%2/2
A
A= $reason
Aresult
11
00
643  
644 # Work around old perl bug
645 13 ▶ if ($] < 5.020000) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.02") 0 13 13
646 0 my $begin = 0;
647 0 my $level = 0;
648 0 ▶ while (my @call = caller($level++)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@call) = CORE::caller $level++) 0 0 0
649 0 ▶ last unless @call && $call[0];
Branch: 1 branch
BranchTrueFalseTotal
unless @call and $call[0] 0 0 0
Condition0%0/3
@call and $call[0]
!ll&&!rl&&r
000
MC/DC0%0/2
@call and $call[0]
@call $call[0]
Truth table0%0/3
A and B
A= @callB= $call[0]
ABresult
0X0
100
111
650 0 ▶ next unless $call[3] =~ m/::BEGIN$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $call[3] =~ /::BEGIN$/ 0 0 0
651 0 $begin++;
652 0 last;
653 }
654 # HACK!
655 0 ▶ die 'Label not found for "last T2_SUBTEST_WRAPPER"' if $begin && $ctx->hub->meta(__PACKAGE__, {})->{parent};
Branch: 1 branch
BranchTrueFalseTotal
if $begin and $ctx->hub->meta(__PACKAGE__, {})->{"parent"} 0 0 0
Condition0%0/3
$begin and $ctx->hub->meta(__PACKAGE__, {})->{"parent"}
!ll&&!rl&&r
000
MC/DC0%0/2
$begin and $ctx->hub->meta(__PACKAGE__, {})->{"parent"}
$begin $ctx->hub->meta(__PACKAGE__, {})->{"parent"}
Truth table0%0/3
A and B
A= $beginB= $ctx->hub->meta(__PACKAGE__, {})->{"parent"}
ABresult
0X0
100
111
656 }
657  
658 13 ▶ $reason = "$reason" if defined $reason;
Branch: 1 branch
BranchTrueFalseTotal
if defined $reason 11 2 13
659  
660 13 $ctx->plan(0, SKIP => $reason);
661 }
662  
663  
664 266 ▶sub exported_to {
Subroutine exported_to: called CC=2 SCAR=6.9
Pod documented
665 266 my( $self, $pack ) = @_;
666  
667 266 ▶ if( defined $pack ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $pack) 155 111 266
668 155 $self->{Exported_To} = $pack;
669 }
670 266 return $self->{Exported_To};
671 }
672  
673  
674 2217 ▶sub ok {
Subroutine ok: called CC=9 SCAR=22.0
Pod documented
675 2217 my( $self, $test, $name ) = @_;
676  
677 2217 my $ctx = $self->ctx;
678  
679 # $test might contain an object which we don't want to accidentally
680 # store, so we turn it into a boolean.
681 2217 ▶ $test = $test ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$test ? : 1723 494 2217
682  
683 # In case $name is a string overloaded object, force it to stringify.
684 183 ▶ no warnings qw/uninitialized numeric/;
Subroutine BEGIN: called CC=1 SCAR=0.0
685 2217 ▶ $name = "$name" if defined $name;
Branch: 1 branch
BranchTrueFalseTotal
if defined $name 1795 422 2217
686  
687 # Profiling showed that the regex here was a huge time waster, doing the
688 # numeric addition first cuts our profile time from ~300ms to ~50ms
689 2217 ▶ $self->diag(<<" ERR") if 0 + $name && $name =~ /^[\d\s]+$/;
Branch: 1 branch
BranchTrueFalseTotal
if 0 + $name and $name =~ /^[\d\s]+$/ 1 2216 2217
Condition100%3/3
0 + $name and $name =~ /^[\d\s]+$/
!ll&&!rl&&r
2176401
MC/DC100%2/2
0 + $name and $name =~ /^[\d\s]+$/
0 + $name $name =~ /^[\d\s]+$/
Truth table100%3/3
A and B
A= 0 + $nameB= $name =~ /^[\d\s]+$/
ABresult
0X0
100
111
690 You named your test '$name'. You shouldn't use numbers for your test names.
691 Very confusing.
692 ERR
693 183 ▶ use warnings qw/uninitialized numeric/;
Subroutine BEGIN: called CC=1 SCAR=0.0
694  
695 2217 my $trace = $ctx->{trace};
696 2217 my $hub = $ctx->{hub};
697  
698 2217 ▶ my $result = {
Branch: 1 branch
BranchTrueFalseTotal
defined $name ? : 1795 422 2217
699 ok => $test,
700 actual_ok => $test,
701 reason => '',
702 type => '',
703 (name => defined($name) ? $name : ''),
704 };
705  
706 2217 ▶ $hub->{_meta}->{+__PACKAGE__}->{Test_Results}[ $hub->{count} ] = $result unless $self->{no_log_results};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"no_log_results"} 2211 6 2217
707  
708 2217 my $orig_name = $name;
709  
710 2217 my @attrs;
711 2217 my $subevents = delete $self->{subevents};
712 2217 my $subtest_id = delete $self->{subtest_id};
713 2217 my $subtest_uuid = delete $self->{subtest_uuid};
714 2217 my $subtest_buffered = delete $self->{subtest_buffered};
715 2217 my $epkg = 'Test2::Event::Ok';
716 2217 ▶ if ($subevents) {
Branch: 1 branch
BranchTrueFalseTotal
if ($subevents) 90 2127 2217
717 90 $epkg = 'Test2::Event::Subtest';
718 90 push @attrs => (subevents => $subevents, subtest_id => $subtest_id, subtest_uuid => $subtest_uuid, buffered => $subtest_buffered);
719 }
720  
721 2217 my $e = bless {
722 trace => bless( {%$trace}, 'Test2::EventFacet::Trace'),
723 pass => $test,
724 name => $name,
725 _meta => {'Test::Builder' => $result},
726 effective_pass => $test,
727 @attrs,
728 }, $epkg;
729 2217 $hub->send($e);
730  
731 2217 ▶ $self->_ok_debug($trace, $orig_name) unless($test);
Branch: 1 branch
BranchTrueFalseTotal
unless $test 494 1723 2217
732  
733 2217 $ctx->release;
734 2217 return $test;
735 }
736  
737 494 ▶sub _ok_debug {
Subroutine _ok_debug: called CC=3 SCAR=11.0
738 494 my $self = shift;
739 494 my ($trace, $orig_name) = @_;
740  
741 494 my $is_todo = $self->in_todo;
742  
743 494 ▶ my $msg = $is_todo ? "Failed (TODO)" : "Failed";
Branch: 1 branch
BranchTrueFalseTotal
$is_todo ? : 250 244 494
744  
745 494 my (undef, $file, $line) = $trace->call;
746 494 ▶ if (defined $orig_name) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $orig_name) { } 452 42 494
747 452 $self->diag(qq[ $msg test '$orig_name'\n at $file line $line.\n]);
748 }
749 else {
750 42 $self->diag(qq[ $msg test at $file line $line.\n]);
751 }
752 }
753  
754 0 ▶sub _diag_fh {
Subroutine _diag_fh: not called CC=2 SCAR=17.9
755 0 my $self = shift;
756 0 local $Level = $Level + 1;
757 0 ▶ return $self->in_todo ? $self->todo_output : $self->failure_output;
Branch: 1 branch
BranchTrueFalseTotal
$self->in_todo ? : 0 0 0
758 }
759  
760 681 ▶sub _unoverload {
Subroutine _unoverload: called CC=5 SCAR=16.1
761 681 my ($self, $type, $thing) = @_;
762  
763 681 ▶ return unless ref $$thing;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $$thing 156 525 681
764 525 ▶ return unless blessed($$thing) || scalar $self->_try(sub{ $$thing->isa('UNIVERSAL') });
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($$thing) or scalar $self->_try(sub { $$thing->isa("UNIVERSAL"); } ) 477 48 525
Condition100%2/2
builtin::blessed($$thing) or scalar $self->_try(sub { $$thing->isa("UNIVERSAL"); } )
l!l
48477
MC/DC100%1/1
builtin::blessed($$thing) or scalar $self->_try(sub { $$thing->isa("UNIVERSAL"); } )
builtin::blessed($$thing)
Truth table100%2/2
A
A= builtin::blessed($$thing)
Aresult
11
00
765 {
766 48 local ($!, $@);
767 48 require overload;
768 }
769 48 ▶ my $string_meth = overload::Method( $$thing, $type ) || return;
Condition100%2/2
overload::Method($$thing, $type) || (return)
l!l
840
MC/DC100%1/1
overload::Method($$thing, $type) || (return)
overload::Method($$thing, $type)
Truth table100%2/2
A
A= overload::Method($$thing, $type)
Aresult
11
00
770 8 $$thing = $$thing->$string_meth(undef, 0);
771 }
772  
773 337 ▶sub _unoverload_str {
Subroutine _unoverload_str: called CC=2 SCAR=6.9
774 337 my $self = shift;
775  
776 337 $self->_unoverload( q[""], $_ ) for @_;
777 }
778  
779 19 ▶sub _unoverload_num {
Subroutine _unoverload_num: called CC=4 SCAR=13.9
780 19 my $self = shift;
781  
782 19 $self->_unoverload( '0+', $_ ) for @_;
783  
784 19 for my $val (@_) {
785 26 ▶ next unless $self->_is_dualvar($$val);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_is_dualvar($$val) 25 1 26
786 1 $$val = $$val + 0;
787 }
788 }
789  
790 # This is a hack to detect a dualvar such as $!
791 26 ▶sub _is_dualvar {
Subroutine _is_dualvar: called CC=4 SCAR=13.9
792 26 my( $self, $val ) = @_;
793  
794 # Objects are not dualvars.
795 26 ▶ return 0 if ref $val;
Branch: 1 branch
BranchTrueFalseTotal
if ref $val 2 24 26
796  
797 183 ▶ no warnings 'numeric';
Subroutine BEGIN: called CC=1 SCAR=0.0
798 24 my $numval = $val + 0;
799 24 ▶ return ($numval != 0 and $numval ne $val ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$numval ne $val ? : 1 20 21
Condition100%3/3
$numval != 0 && ($numval ne $val ? 1 : 0)
!ll&&!rl&&r
3201
MC/DC100%2/2
$numval != 0 && ($numval ne $val ? 1 : 0)
$numval != 0 ($numval ne $val ? 1 : 0)
Truth table100%3/3
A && B
A= $numval != 0B= ($numval ne $val ? 1 : 0)
ABresult
0X0
100
111
800 }
801  
802  
803 521 ▶sub is_eq {
Subroutine is_eq: called CC=5 SCAR=16.1
Pod documented
804 521 my( $self, $got, $expect, $name ) = @_;
805  
806 521 my $ctx = $self->ctx;
807  
808 521 local $Level = $Level + 1;
809  
810 521 ▶ if( !defined $got || !defined $expect ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $got and defined $expect) 14 507 521
Condition100%3/3
defined $got and defined $expect
!ll&&!rl&&r
122507
MC/DC100%2/2
defined $got and defined $expect
defined $got defined $expect
Truth table100%3/3
A and B
A= defined $gotB= defined $expect
ABresult
0X0
100
111
811 # undef only matches undef and nothing else
812 14 ▶ my $test = !defined $got && !defined $expect;
Condition100%3/3
defined $got || defined $expect
l!l&&r!l&&!r
2210
MC/DC100%2/2
defined $got || defined $expect
defined $got defined $expect
Truth table100%3/3
A || B
A= defined $gotB= defined $expect
ABresult
1X1
011
000
813  
814 14 $self->ok( $test, $name );
815 14 ▶ $self->_is_diag( $got, 'eq', $expect ) unless $test;
Branch: 1 branch
BranchTrueFalseTotal
unless $test 4 10 14
816 14 $ctx->release;
817 14 return $test;
818 }
819  
820 507 release $ctx, $self->cmp_ok( $got, 'eq', $expect, $name );
821 }
822  
823  
824 66 ▶sub is_num {
Subroutine is_num: called CC=5 SCAR=16.5
Pod documented
825 66 my( $self, $got, $expect, $name ) = @_;
826 66 my $ctx = $self->ctx;
827 66 local $Level = $Level + 1;
828  
829 66 ▶ if( !defined $got || !defined $expect ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $got and defined $expect) 1 65 66
Condition66%2/3
defined $got and defined $expect
!ll&&!rl&&r
1065
MC/DC50%1/2
defined $got and defined $expect
defined $got defined $expect
Truth table66%2/3
A and B
A= defined $gotB= defined $expect
ABresult
0X0
100
111
830 # undef only matches undef and nothing else
831 1 ▶ my $test = !defined $got && !defined $expect;
Condition33%1/3
defined $got || defined $expect
l!l&&r!l&&!r
001
MC/DC0%0/2
defined $got || defined $expect
defined $got defined $expect
Truth table33%1/3
A || B
A= defined $gotB= defined $expect
ABresult
1X1
011
000
832  
833 1 $self->ok( $test, $name );
834 1 ▶ $self->_is_diag( $got, '==', $expect ) unless $test;
Branch: 1 branch
BranchTrueFalseTotal
unless $test 0 1 1
835 1 $ctx->release;
836 1 return $test;
837 }
838  
839 65 release $ctx, $self->cmp_ok( $got, '==', $expect, $name );
840 }
841  
842  
843 52 ▶sub _diag_fmt {
Subroutine _diag_fmt: called CC=4 SCAR=13.9
844 52 my( $self, $type, $val ) = @_;
845  
846 52 ▶ if( defined $$val ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $$val) { } 47 5 52
847 47 ▶ if( $type eq 'eq' or $type eq 'ne' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq 'eq' or $type eq 'ne') { } 35 12 47
Condition100%3/3
$type eq "eq" or $type eq "ne"
l!l&&r!l&&!r
32312
MC/DC100%2/2
$type eq "eq" or $type eq "ne"
$type eq "eq" $type eq "ne"
Truth table100%3/3
A or B
A= $type eq "eq"B= $type eq "ne"
ABresult
1X1
011
000
848 # quote and force string context
849 35 $$val = "'$$val'";
850 }
851 else {
852 # force numeric context
853 12 $self->_unoverload_num($val);
854 }
855 }
856 else {
857 5 $$val = 'undef';
858 }
859  
860 52 return;
861 }
862  
863  
864 23 ▶sub _is_diag {
Subroutine _is_diag: called CC=2 SCAR=6.9
865 23 my( $self, $got, $type, $expect ) = @_;
866  
867 23 $self->_diag_fmt( $type, $_ ) for \$got, \$expect;
868  
869 23 local $Level = $Level + 1;
870 23 return $self->diag(<<"DIAGNOSTIC");
871 got: $got
872 expected: $expect
873 DIAGNOSTIC
874  
875 }
876  
877 6 ▶sub _isnt_diag {
Subroutine _isnt_diag: called CC=1 SCAR=0.0
878 6 my( $self, $got, $type ) = @_;
879  
880 6 $self->_diag_fmt( $type, \$got );
881  
882 6 local $Level = $Level + 1;
883 6 return $self->diag(<<"DIAGNOSTIC");
884 got: $got
885 expected: anything else
886 DIAGNOSTIC
887 }
888  
889  
890 12 ▶sub isnt_eq {
Subroutine isnt_eq: called CC=5 SCAR=16.1
Pod documented
891 12 my( $self, $got, $dont_expect, $name ) = @_;
892 12 my $ctx = $self->ctx;
893 12 local $Level = $Level + 1;
894  
895 12 ▶ if( !defined $got || !defined $dont_expect ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $got and defined $dont_expect) 4 8 12
Condition66%2/3
defined $got and defined $dont_expect
!ll&&!rl&&r
408
MC/DC50%1/2
defined $got and defined $dont_expect
defined $got defined $dont_expect
Truth table66%2/3
A and B
A= defined $gotB= defined $dont_expect
ABresult
0X0
100
111
896 # undef only matches undef and nothing else
897 4 ▶ my $test = defined $got || defined $dont_expect;
Condition66%2/3
defined $got || defined $dont_expect
l!l&&r!l&&!r
031
MC/DC50%1/2
defined $got || defined $dont_expect
defined $got defined $dont_expect
Truth table66%2/3
A || B
A= defined $gotB= defined $dont_expect
ABresult
1X1
011
000
898  
899 4 $self->ok( $test, $name );
900 4 ▶ $self->_isnt_diag( $got, 'ne' ) unless $test;
Branch: 1 branch
BranchTrueFalseTotal
unless $test 1 3 4
901 4 $ctx->release;
902 4 return $test;
903 }
904  
905 8 release $ctx, $self->cmp_ok( $got, 'ne', $dont_expect, $name );
906 }
907  
908 2 ▶sub isnt_num {
Subroutine isnt_num: called CC=5 SCAR=16.5
Pod documented
909 2 my( $self, $got, $dont_expect, $name ) = @_;
910 2 my $ctx = $self->ctx;
911 2 local $Level = $Level + 1;
912  
913 2 ▶ if( !defined $got || !defined $dont_expect ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $got and defined $dont_expect) 1 1 2
Condition66%2/3
defined $got and defined $dont_expect
!ll&&!rl&&r
011
MC/DC50%1/2
defined $got and defined $dont_expect
defined $got defined $dont_expect
Truth table66%2/3
A and B
A= defined $gotB= defined $dont_expect
ABresult
0X0
100
111
914 # undef only matches undef and nothing else
915 1 ▶ my $test = defined $got || defined $dont_expect;
Condition33%1/3
defined $got || defined $dont_expect
l!l&&r!l&&!r
100
MC/DC0%0/2
defined $got || defined $dont_expect
defined $got defined $dont_expect
Truth table33%1/3
A || B
A= defined $gotB= defined $dont_expect
ABresult
1X1
011
000
916  
917 1 $self->ok( $test, $name );
918 1 ▶ $self->_isnt_diag( $got, '!=' ) unless $test;
Branch: 1 branch
BranchTrueFalseTotal
unless $test 0 1 1
919 1 $ctx->release;
920 1 return $test;
921 }
922  
923 1 release $ctx, $self->cmp_ok( $got, '!=', $dont_expect, $name );
924 }
925  
926  
927 317 ▶sub like {
Subroutine like: called CC=1 SCAR=0.0
Pod documented
928 317 my( $self, $thing, $regex, $name ) = @_;
929 317 my $ctx = $self->ctx;
930  
931 317 local $Level = $Level + 1;
932  
933 317 release $ctx, $self->_regex_ok( $thing, $regex, '=~', $name );
934 }
935  
936 5 ▶sub unlike {
Subroutine unlike: called CC=1 SCAR=0.0
Pod documented
937 5 my( $self, $thing, $regex, $name ) = @_;
938 5 my $ctx = $self->ctx;
939  
940 5 local $Level = $Level + 1;
941  
942 5 release $ctx, $self->_regex_ok( $thing, $regex, '!~', $name );
943 }
944  
945  
946 183 my %numeric_cmps = map { ( $_, 1 ) } ( "<", "<=", ">", ">=", "==", "!=", "<=>" );
947  
948 # Bad, these are not comparison operators. Should we include more?
949 183 my %cmp_ok_bl = map { ( $_, 1 ) } ( "=", "+=", ".=", "x=", "^=", "|=", "||=", "&&=", "...");
950  
951 617 ▶sub cmp_ok {
Subroutine cmp_ok: called CC=11 SCAR=24.0
Pod documented
952 617 my( $self, $got, $type, $expect, $name ) = @_;
953 617 my $ctx = $self->ctx;
954  
955 617 ▶ if ($cmp_ok_bl{$type}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmp_ok_bl{$type}) 2 615 617
956 2 $ctx->throw("$type is not a valid comparison operator in cmp_ok()");
957 }
958  
959 615 my ($test, $succ);
960 615 my $error;
961 {
962 ## no critic (BuiltinFunctions::ProhibitStringyEval)
963  
964 615 local( $@, $!, $SIG{__DIE__} ); # isolate eval
965  
966 615 my($pack, $file, $line) = $ctx->trace->call();
967 615 my $warning_bits = $ctx->trace->warning_bits;
968 # convert this to a code string so the BEGIN doesn't have to close
969 # over it, which can lead to issues with Devel::Cover
970 615 ▶ my $bits_code = defined $warning_bits ? qq["\Q$warning_bits\E"] : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $warning_bits ? : 441 174 615
971  
972 # Make sure warnings and location matches the caller. Can't do the
973 # comparison directly in the eval, as closing over variables can
974 # capture them forever when running with Devel::Cover.
975 615 my $check;
976 615 ▶ $succ = eval qq[
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
977 BEGIN {\${^WARNING_BITS} = $bits_code};
978 #line $line "(eval in cmp_ok) $file"
979 \$check = sub { \$_[0] $type \$_[1] };
980 1;
981 ];
982  
983 615 ▶ if ($succ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($succ) 614 1 615
984 614 $succ = eval {
985 614 $test = $check->($got, $expect);
986 612 1;
987 };
988 }
989 615 $error = $@;
990 }
991 615 local $Level = $Level + 1;
992 615 my $ok = $self->ok( $test, $name );
993  
994 # Treat overloaded objects as numbers if we're asked to do a
995 # numeric comparison.
996 my $unoverload
997 615 ▶ = $numeric_cmps{$type}
Branch: 1 branch
BranchTrueFalseTotal
$numeric_cmps{$type} ? : 82 533 615
998 ? '_unoverload_num'
999 : '_unoverload_str';
1000  
1001 615 ▶ $self->diag(<<"END") unless $succ;
Branch: 1 branch
BranchTrueFalseTotal
unless $succ 3 612 615
1002 An error occurred while using $type:
1003 ------------------------------------
1004 $error
1005 ------------------------------------
1006 END
1007  
1008 615 ▶ unless($ok) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ok) 29 586 615
1009 29 $self->$unoverload( \$got, \$expect );
1010  
1011 29 ▶ if( $type =~ /^(eq|==)$/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($type =~ /^(eq|==)$/) { } 19 10 29
elsif ($type =~ /^(ne|!=)$/) { } 7 3 10
1012 19 $self->_is_diag( $got, $type, $expect );
1013 }
1014 elsif( $type =~ /^(ne|!=)$/ ) {
1015 7 ▶ if (defined($got) xor defined($expect)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $got xor defined $expect) { } 2 5 7
Condition50%2/4
defined $got xor defined $expect
l&&rl&&!r!l&&r!l&&!r
5020
MC/DC50%1/2
defined $got xor defined $expect
defined $got defined $expect
Truth table50%2/4
A xor B
A= defined $gotB= defined $expect
ABresult
110
101
011
000
1016 2 $self->_cmp_diag( $got, $type, $expect );
1017 }
1018 else {
1019 5 $self->_isnt_diag( $got, $type );
1020 }
1021 }
1022 else {
1023 3 $self->_cmp_diag( $got, $type, $expect );
1024 }
1025 }
1026 615 return release $ctx, $ok;
1027 }
1028  
1029 5 ▶sub _cmp_diag {
Subroutine _cmp_diag: called CC=3 SCAR=11.0
1030 5 my( $self, $got, $type, $expect ) = @_;
1031  
1032 5 ▶ $got = defined $got ? "'$got'" : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $got ? : 3 2 5
1033 5 ▶ $expect = defined $expect ? "'$expect'" : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $expect ? : 5 0 5
1034  
1035 5 local $Level = $Level + 1;
1036 5 return $self->diag(<<"DIAGNOSTIC");
1037 $got
1038 $type
1039 $expect
1040 DIAGNOSTIC
1041 }
1042  
1043 321 ▶sub _caller_context {
Subroutine _caller_context: called CC=3 SCAR=11.8
1044 321 my $self = shift;
1045  
1046 321 my( $pack, $file, $line ) = $self->caller(1);
1047  
1048 321 my $code = '';
1049 321 ▶ $code .= "#line $line $file\n" if defined $file and defined $line;
Branch: 1 branch
BranchTrueFalseTotal
if defined $file and defined $line 321 0 321
Condition33%1/3
defined $file and defined $line
!ll&&!rl&&r
00321
MC/DC0%0/2
defined $file and defined $line
defined $file defined $line
Truth table33%1/3
A and B
A= defined $fileB= defined $line
ABresult
0X0
100
111
1050  
1051 321 return $code;
1052 }
1053  
1054  
1055 2 ▶sub BAIL_OUT {
Subroutine BAIL_OUT: called CC=1 SCAR=0.0
Pod documented
1056 2 my( $self, $reason ) = @_;
1057  
1058 2 my $ctx = $self->ctx;
1059  
1060 2 $self->{Bailed_Out} = 1;
1061  
1062 2 $ctx->bail($reason);
1063 }
1064  
1065  
1066 {
1067 183 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
1068 183 *BAILOUT = \&BAIL_OUT;
1069 }
1070  
1071 19 ▶sub skip {
Subroutine skip: called CC=4 SCAR=13.9
Pod documented
1072 19 my( $self, $why, $name ) = @_;
1073 19 ▶ $why ||= '';
Condition50%1/2
$why ||= ""
l!l
190
MC/DC0%0/1
$why ||= ""
$why
Truth table50%1/2
A
A= $why
Aresult
11
00
1074 19 ▶ $name = '' unless defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 15 4 19
1075 19 $self->_unoverload_str( \$why );
1076  
1077 19 my $ctx = $self->ctx;
1078  
1079 19 $name = "$name";
1080 19 $why = "$why";
1081  
1082 19 $name =~ s|#|\\#|g; # # in a name can confuse Test::Harness.
1083 19 $name =~ s{\n}{\n# }sg;
1084 19 $why =~ s{\n}{\n# }sg;
1085  
1086 $ctx->hub->meta(__PACKAGE__, {})->{Test_Results}[ $ctx->hub->count ] = {
1087 'ok' => 1,
1088 actual_ok => 1,
1089 name => $name,
1090 type => 'skip',
1091 reason => $why,
1092 19 ▶ } unless $self->{no_log_results};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"no_log_results"} 19 0 19
1093  
1094 19 my $tctx = $ctx->snapshot;
1095 19 $tctx->skip('', $why);
1096  
1097 19 return release $ctx, 1;
1098 }
1099  
1100  
1101 6 ▶sub todo_skip {
Subroutine todo_skip: called CC=3 SCAR=11.1
Pod documented
1102 6 my( $self, $why ) = @_;
1103 6 ▶ $why ||= '';
Condition50%1/2
$why ||= ""
l!l
60
MC/DC0%0/1
$why ||= ""
$why
Truth table50%1/2
A
A= $why
Aresult
11
00
1104  
1105 6 my $ctx = $self->ctx;
1106  
1107 $ctx->hub->meta(__PACKAGE__, {})->{Test_Results}[ $ctx->hub->count ] = {
1108 'ok' => 1,
1109 actual_ok => 0,
1110 name => '',
1111 type => 'todo_skip',
1112 reason => $why,
1113 6 ▶ } unless $self->{no_log_results};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"no_log_results"} 6 0 6
1114  
1115 6 $why =~ s{\n}{\n# }sg;
1116 6 my $tctx = $ctx->snapshot;
1117 6 $tctx->send_event( 'Skip', todo => $why, todo_diag => 1, reason => $why, pass => 0);
1118  
1119 6 return release $ctx, 1;
1120 }
1121  
1122  
1123 329 ▶sub maybe_regex {
Subroutine maybe_regex: called CC=6 SCAR=17.9
Pod documented
1124 329 my( $self, $regex ) = @_;
1125 329 my $usable_regex = undef;
1126  
1127 329 ▶ return $usable_regex unless defined $regex;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $regex 1 328 329
1128  
1129 328 my( $re, $opts );
1130  
1131 # Check for qr/foo/
1132 328 ▶ if( _is_qr($regex) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (_is_qr($regex)) { } 304 24 328
elsif (() = $regex =~ m[^ /(.*)/ (\w*) $ ]sx or (undef, $re, $opts) = $regex =~ /^ m([^\w\s]) (.+) \1 (\w*) $/sx) { } 22 2 24
1133 304 $usable_regex = $regex;
1134 }
1135 # Check for '/foo/' or 'm,foo,'
1136 ▶ elsif(( $re, $opts ) = $regex =~ m{^ /(.*)/ (\w*) $ }sx or
Condition100%3/3
() = $regex =~ m[^ /(.*)/ (\w*) $ ]sx or (undef, $re, $opts) = $regex =~ /^ m([^\w\s]) (.+) \1 (\w*) $/sx
l!l&&r!l&&!r
2112
MC/DC100%2/2
() = $regex =~ m[^ /(.*)/ (\w*) $ ]sx or (undef, $re, $opts) = $regex =~ /^ m([^\w\s]) (.+) \1 (\w*) $/sx
() = $regex =~ m[^ /(.*)/ (\w*) $ ]sx (undef, $re, $opts) = $regex =~ /^ m([^\w\s]) (.+) \1 (\w*) $/sx
Truth table100%3/3
A or B
A= () = $regex =~ m[^ /(.*)/ (\w*) $ ]sxB= (undef, $re, $opts) = $regex =~ /^ m([^\w\s]) (.+) \1 (\w*) $/sx
ABresult
1X1
011
000
1137 ( undef, $re, $opts ) = $regex =~ m,^ m([^\w\s]) (.+) \1 (\w*) $,sx
1138 )
1139 {
1140 22 ▶ $usable_regex = length $opts ? "(?$opts)$re" : $re;
Branch: 1 branch
BranchTrueFalseTotal
length $opts ? : 3 19 22
1141 }
1142  
1143 328 return $usable_regex;
1144 }
1145  
1146 328 ▶sub _is_qr {
Subroutine _is_qr: called CC=2 SCAR=8.1
1147 328 my $regex = shift;
1148  
1149 # is_regexp() checks for regexes in a robust manner, say if they're
1150 # blessed.
1151 328 ▶ return re::is_regexp($regex) if defined &re::is_regexp;
Branch: 1 branch
BranchTrueFalseTotal
if defined &re::is_regexp 328 0 328
1152 0 return ref $regex eq 'Regexp';
1153 }
1154  
1155 322 ▶sub _regex_ok {
Subroutine _regex_ok: called CC=6 SCAR=17.9
1156 322 my( $self, $thing, $regex, $cmp, $name ) = @_;
1157  
1158 322 my $ok = 0;
1159 322 my $usable_regex = $self->maybe_regex($regex);
1160 322 ▶ unless( defined $usable_regex ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $usable_regex) 1 321 322
1161 1 local $Level = $Level + 1;
1162 1 $ok = $self->ok( 0, $name );
1163 1 $self->diag(" '$regex' doesn't look much like a regex to me.");
1164 1 return $ok;
1165 }
1166  
1167 {
1168 321 my $test;
1169 321 my $context = $self->_caller_context;
1170  
1171 {
1172 ## no critic (BuiltinFunctions::ProhibitStringyEval)
1173  
1174 321 local( $@, $!, $SIG{__DIE__} ); # isolate eval
1175  
1176 # No point in issuing an uninit warning, they'll see it in the diagnostics
1177 183 ▶ no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
1178  
1179 321 $test = eval $context . q{$test = $thing =~ /$usable_regex/ ? 1 : 0};
1180 }
1181  
1182 321 ▶ $test = !$test if $cmp eq '!~';
Branch: 1 branch
BranchTrueFalseTotal
if $cmp eq "!~" 5 316 321
1183  
1184 321 local $Level = $Level + 1;
1185 321 $ok = $self->ok( $test, $name );
1186 }
1187  
1188 321 ▶ unless($ok) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ok) 5 316 321
1189 5 ▶ $thing = defined $thing ? "'$thing'" : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $thing ? : 5 0 5
1190 5 ▶ my $match = $cmp eq '=~' ? "doesn't match" : "matches";
Branch: 1 branch
BranchTrueFalseTotal
$cmp eq '=~' ? : 4 1 5
1191  
1192 5 local $Level = $Level + 1;
1193 5 $self->diag( sprintf <<'DIAGNOSTIC', $thing, $match, $regex );
1194 %s
1195 %13s '%s'
1196 DIAGNOSTIC
1197  
1198 }
1199  
1200 321 return $ok;
1201 }
1202  
1203  
1204 1209 ▶sub is_fh {
Subroutine is_fh: called CC=5 SCAR=16.1
Pod documented
1205 1209 my $self = shift;
1206 1209 my $maybe_fh = shift;
1207 1209 ▶ return 0 unless defined $maybe_fh;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $maybe_fh 1 1208 1209
1208  
1209 1208 ▶ return 1 if ref $maybe_fh eq 'GLOB'; # its a glob ref
Branch: 1 branch
BranchTrueFalseTotal
if ref $maybe_fh eq "GLOB" 1026 182 1208
1210 182 ▶ return 1 if ref \$maybe_fh eq 'GLOB'; # its a glob
Branch: 1 branch
BranchTrueFalseTotal
if ref \$maybe_fh eq "GLOB" 2 180 182
1211  
1212 180 return eval { $maybe_fh->isa("IO::Handle") } ||
1213 180 ▶ eval { tied($maybe_fh)->can('TIEHANDLE') };
Condition66%2/3
eval { do { $maybe_fh->isa('IO::Handle') } } || eval { do { tied($maybe_fh)->can('TIEHANDLE') } }
l!l&&r!l&&!r
70173
MC/DC50%1/2
eval { do { $maybe_fh->isa('IO::Handle') } } || eval { do { tied($maybe_fh)->can('TIEHANDLE') } }
eval { do { $maybe_fh->isa('IO::Handle') } } eval { do { tied($maybe_fh)->can('TIEHANDLE') } }
Truth table66%2/3
A || B
A= eval { do { $maybe_fh->isa('IO::Handle') } }B= eval { do { tied($maybe_fh)->can('TIEHANDLE') } }
ABresult
1X1
011
000
1214 }
1215  
1216  
1217 20 ▶sub level {
Subroutine level: called CC=2 SCAR=6.9
Pod documented
1218 20 my( $self, $level ) = @_;
1219  
1220 20 ▶ if( defined $level ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $level) 18 2 20
1221 18 $Level = $level;
1222 }
1223 20 return $Level;
1224 }
1225  
1226  
1227 241 ▶sub use_numbers {
Subroutine use_numbers: called CC=7 SCAR=19.6
Pod documented
1228 241 my( $self, $use_nums ) = @_;
1229  
1230 241 my $ctx = $self->ctx;
1231 241 my $format = $ctx->hub->format;
1232 241 ▶ unless ($format && $format->can('no_numbers') && $format->can('set_no_numbers')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($format and $format->can("no_numbers") and $format->can("set_no_numbers")) 3 238 241
Condition66%4/6
$format and $format->can("no_numbers") and $format->can("set_no_numbers")
!ll&&!rl&&r
30238
$format and $format->can("no_numbers")
!ll&&!rl&&r
30238
MC/DC33%1/3
$format and $format->can("no_numbers") and $format->can("set_no_numbers")
$format $format->can("no_numbers") $format->can("set_no_numbers")
Truth table50%2/4
A and B and C
A= $formatB= $format->can("no_numbers")C= $format->can("set_no_numbers")
ABCresult
0XX0
10X0
1100
1111
1233 3 ▶ warn "The current formatter does not support 'use_numbers'" if $format;
Branch: 1 branch
BranchTrueFalseTotal
if $format 0 3 3
1234 3 return release $ctx, 0;
1235 }
1236  
1237 238 ▶ $format->set_no_numbers(!$use_nums) if defined $use_nums;
Branch: 1 branch
BranchTrueFalseTotal
if defined $use_nums 237 1 238
1238  
1239 238 ▶ return release $ctx, $format->no_numbers ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$format->no_numbers ? : 2 236 238
1240 }
1241  
1242 190 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=6.9
1243 183 for my $method (qw(no_header no_diag)) {
1244 366 my $set = "set_$method";
1245 61 ▶ my $code = sub {
Subroutine __ANON__: called CC=6 SCAR=18.0
1246 61 my( $self, $no ) = @_;
1247  
1248 61 my $ctx = $self->ctx;
1249 61 my $format = $ctx->hub->format;
1250 61 ▶ unless ($format && $format->can($set)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($format and $format->can($set)) 1 60 61
Condition66%2/3
$format and $format->can($set)
!ll&&!rl&&r
1060
MC/DC50%1/2
$format and $format->can($set)
$format $format->can($set)
Truth table66%2/3
A and B
A= $formatB= $format->can($set)
ABresult
0X0
100
111
1251 1 ▶ warn "The current formatter does not support '$method'" if $format;
Branch: 1 branch
BranchTrueFalseTotal
if $format 0 1 1
1252 1 $ctx->release;
1253 return
1254 1 }
1255  
1256 60 ▶ $format->$set($no) if defined $no;
Branch: 1 branch
BranchTrueFalseTotal
if defined $no 58 2 60
1257  
1258 60 ▶ return release $ctx, $format->$method ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$format->$method ? : 5 55 60
1259 366 };
1260  
1261 183 ▶ no strict 'refs'; ## no critic
Subroutine BEGIN: called CC=1 SCAR=0.0
1262 366 *$method = $code;
1263 }
1264 }
1265  
1266 198 ▶sub no_ending {
Subroutine no_ending: called CC=2 SCAR=6.9
Pod documented
1267 198 my( $self, $no ) = @_;
1268  
1269 198 my $ctx = $self->ctx;
1270  
1271 198 ▶ $ctx->hub->set_no_ending($no) if defined $no;
Branch: 1 branch
BranchTrueFalseTotal
if defined $no 197 1 198
1272  
1273 198 return release $ctx, $ctx->hub->no_ending;
1274 }
1275  
1276 650 ▶sub diag {
Subroutine diag: called CC=4 SCAR=13.9
Pod documented
1277 650 my $self = shift;
1278 650 ▶ return unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 8 642 650
1279  
1280 642 ▶ my $text = join '' => map {defined($_) ? $_ : 'undef'} @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 646 1 647
1281  
1282 642 ▶ if (Test2::API::test2_in_preload()) {
Branch: 1 branch
BranchTrueFalseTotal
if (Test2::API::test2_in_preload()) 1 641 642
1283 1 chomp($text);
1284 1 $text =~ s/^/# /msg;
1285 1 print STDERR $text, "\n";
1286 1 return 0;
1287 }
1288  
1289 641 my $ctx = $self->ctx;
1290 641 $ctx->diag($text);
1291 641 $ctx->release;
1292 641 return 0;
1293 }
1294  
1295  
1296 13 ▶sub note {
Subroutine note: called CC=4 SCAR=13.9
Pod documented
1297 13 my $self = shift;
1298 13 ▶ return unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 13 13
1299  
1300 13 ▶ my $text = join '' => map {defined($_) ? $_ : 'undef'} @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 14 0 14
1301  
1302 13 ▶ if (Test2::API::test2_in_preload()) {
Branch: 1 branch
BranchTrueFalseTotal
if (Test2::API::test2_in_preload()) 1 12 13
1303 1 chomp($text);
1304 1 $text =~ s/^/# /msg;
1305 1 print STDOUT $text, "\n";
1306 1 return 0;
1307 }
1308  
1309 12 my $ctx = $self->ctx;
1310 12 $ctx->note($text);
1311 12 $ctx->release;
1312 12 return 0;
1313 }
1314  
1315  
1316 5 ▶sub explain {
Subroutine explain: called CC=3 SCAR=11.0
Pod documented
1317 5 my $self = shift;
1318  
1319 5 local ($@, $!);
1320 5 require Data::Dumper;
1321  
1322 return map {
1323 5 ref $_
1324 9 ▶ ? do {
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 4 5 9
1325 4 my $dumper = Data::Dumper->new( [$_] );
1326 4 $dumper->Indent(1)->Terse(1);
1327 4 ▶ $dumper->Sortkeys(1) if $dumper->can("Sortkeys");
Branch: 1 branch
BranchTrueFalseTotal
if $dumper->can("Sortkeys") 4 0 4
1328 4 $dumper->Dump;
1329 }
1330 : $_
1331 } @_;
1332 }
1333  
1334  
1335 505 ▶sub output {
Subroutine output: called CC=4 SCAR=14.2
Pod documented
1336 505 my( $self, $fh ) = @_;
1337  
1338 505 my $ctx = $self->ctx;
1339 505 my $format = $ctx->hub->format;
1340 505 $ctx->release;
1341 505 ▶ return unless $format && $format->isa('Test2::Formatter::TAP');
Branch: 1 branch
BranchTrueFalseTotal
unless $format and $format->isa("Test2::Formatter::TAP") 0 505 505
Condition33%1/3
$format and $format->isa("Test2::Formatter::TAP")
!ll&&!rl&&r
00505
MC/DC0%0/2
$format and $format->isa("Test2::Formatter::TAP")
$format $format->isa("Test2::Formatter::TAP")
Truth table33%1/3
A and B
A= $formatB= $format->isa("Test2::Formatter::TAP")
ABresult
0X0
100
111
1342  
1343 505 ▶ $format->handles->[Test2::Formatter::TAP::OUT_STD()] = $self->_new_fh($fh)
Branch: 1 branch
BranchTrueFalseTotal
if defined $fh 353 152 505
1344 if defined $fh;
1345  
1346 505 return $format->handles->[Test2::Formatter::TAP::OUT_STD()];
1347 }
1348  
1349 498 ▶sub failure_output {
Subroutine failure_output: called CC=4 SCAR=14.2
Pod documented
1350 498 my( $self, $fh ) = @_;
1351  
1352 498 my $ctx = $self->ctx;
1353 498 my $format = $ctx->hub->format;
1354 498 $ctx->release;
1355 498 ▶ return unless $format && $format->isa('Test2::Formatter::TAP');
Branch: 1 branch
BranchTrueFalseTotal
unless $format and $format->isa("Test2::Formatter::TAP") 0 498 498
Condition33%1/3
$format and $format->isa("Test2::Formatter::TAP")
!ll&&!rl&&r
00498
MC/DC0%0/2
$format and $format->isa("Test2::Formatter::TAP")
$format $format->isa("Test2::Formatter::TAP")
Truth table33%1/3
A and B
A= $formatB= $format->isa("Test2::Formatter::TAP")
ABresult
0X0
100
111
1356  
1357 498 ▶ $format->handles->[Test2::Formatter::TAP::OUT_ERR()] = $self->_new_fh($fh)
Branch: 1 branch
BranchTrueFalseTotal
if defined $fh 346 152 498
1358 if defined $fh;
1359  
1360 498 return $format->handles->[Test2::Formatter::TAP::OUT_ERR()];
1361 }
1362  
1363 496 ▶sub todo_output {
Subroutine todo_output: called CC=4 SCAR=14.2
Pod documented
1364 496 my( $self, $fh ) = @_;
1365  
1366 496 my $ctx = $self->ctx;
1367 496 my $format = $ctx->hub->format;
1368 496 $ctx->release;
1369 496 ▶ return unless $format && $format->isa('Test::Builder::Formatter');
Branch: 1 branch
BranchTrueFalseTotal
unless $format and $format->isa("Test::Builder::Formatter") 0 496 496
Condition33%1/3
$format and $format->isa("Test::Builder::Formatter")
!ll&&!rl&&r
00496
MC/DC0%0/2
$format and $format->isa("Test::Builder::Formatter")
$format $format->isa("Test::Builder::Formatter")
Truth table33%1/3
A and B
A= $formatB= $format->isa("Test::Builder::Formatter")
ABresult
0X0
100
111
1370  
1371 496 ▶ $format->handles->[Test::Builder::Formatter::OUT_TODO()] = $self->_new_fh($fh)
Branch: 1 branch
BranchTrueFalseTotal
if defined $fh 344 152 496
1372 if defined $fh;
1373  
1374 496 return $format->handles->[Test::Builder::Formatter::OUT_TODO()];
1375 }
1376  
1377 1199 ▶sub _new_fh {
Subroutine _new_fh: called CC=5 SCAR=16.2
1378 1199 my $self = shift;
1379 1199 my ($file_or_fh) = shift;
1380  
1381 1199 my $fh;
1382 1199 ▶ if ($self->is_fh($file_or_fh)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->is_fh($file_or_fh)) { } 1028 171 1199
elsif (ref $file_or_fh eq 'SCALAR') { } 170 1 171
1383 1028 $fh = $file_or_fh;
1384 }
1385 elsif (ref $file_or_fh eq 'SCALAR') {
1386 170 ▶ open $fh, ">>", $file_or_fh
Branch: 1 branch
BranchTrueFalseTotal
open $fh, ">>", $file_or_fh or $self->croak("Can't open scalar ref ${file_or_fh}: $!") 170 0 170
1387 or $self->croak("Can't open scalar ref $file_or_fh: $!");
1388 }
1389 else {
1390 1 ▶ open $fh, ">", $file_or_fh
Branch: 1 branch
BranchTrueFalseTotal
open $fh, ">", $file_or_fh or $self->croak("Can't open test output log ${file_or_fh}: $!") 1 0 1
1391 or $self->croak("Can't open test output log $file_or_fh: $!");
1392 1 _autoflush($fh);
1393 }
1394  
1395 1199 return $fh;
1396 }
1397  
1398 1 ▶sub _autoflush {
Subroutine _autoflush: called CC=1 SCAR=0.0
1399 1 my($fh) = shift;
1400 1 my $old_fh = select $fh;
1401 1 $| = 1;
1402 1 select $old_fh;
1403  
1404 1 return;
1405 }
1406  
1407  
1408 241 ▶sub reset_outputs {
Subroutine reset_outputs: called CC=4 SCAR=14.0
Pod documented
1409 241 my $self = shift;
1410  
1411 241 my $ctx = $self->ctx;
1412 241 my $format = $ctx->hub->format;
1413 241 $ctx->release;
1414 241 ▶ return unless $format && $format->isa('Test2::Formatter::TAP');
Branch: 1 branch
BranchTrueFalseTotal
unless $format and $format->isa("Test2::Formatter::TAP") 2 239 241
Condition66%2/3
$format and $format->isa("Test2::Formatter::TAP")
!ll&&!rl&&r
20239
MC/DC50%1/2
$format and $format->isa("Test2::Formatter::TAP")
$format $format->isa("Test2::Formatter::TAP")
Truth table66%2/3
A and B
A= $formatB= $format->isa("Test2::Formatter::TAP")
ABresult
0X0
100
111
1415 239 ▶ $format->set_handles([@{$self->{Orig_Handles}}]) if $self->{Orig_Handles};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"Orig_Handles"} 239 0 239
1416  
1417 239 return;
1418 }
1419  
1420  
1421 1 ▶sub carp {
Subroutine carp: called CC=1 SCAR=0.0
Pod documented
1422 1 my $self = shift;
1423 1 my $ctx = $self->ctx;
1424 1 $ctx->alert(join "", @_);
1425 1 $ctx->release;
1426 }
1427  
1428 7 ▶sub croak {
Subroutine croak: called CC=1 SCAR=0.2
Pod documented
1429 7 my $self = shift;
1430 7 my $ctx = $self->ctx;
1431 7 $ctx->throw(join "", @_);
1432 0 $ctx->release;
1433 }
1434  
1435  
1436 507 ▶sub current_test {
Subroutine current_test: called CC=7 SCAR=19.5
Pod documented
1437 507 my( $self, $num ) = @_;
1438  
1439 507 my $ctx = $self->ctx;
1440 507 my $hub = $ctx->hub;
1441  
1442 507 ▶ if( defined $num ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $num) 307 200 507
1443 307 $hub->set_count($num);
1444  
1445 307 ▶ unless ($self->{no_log_results}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"no_log_results"}) 307 0 307
1446 # If the test counter is being pushed forward fill in the details.
1447 307 my $test_results = $ctx->hub->meta(__PACKAGE__, {})->{Test_Results};
1448 307 ▶ if ($num > @$test_results) {
Branch: 2 branches
BranchTrueFalseTotal
if ($num > @$test_results) { } 136 171 307
elsif ($num < @$test_results) { } 147 24 171
1449 136 ▶ my $start = @$test_results ? @$test_results : 0;
Branch: 1 branch
BranchTrueFalseTotal
@$test_results ? : 130 6 136
1450 136 for ($start .. $num - 1) {
1451 4528 $test_results->[$_] = {
1452 'ok' => 1,
1453 actual_ok => undef,
1454 reason => 'incrementing test number',
1455 type => 'unknown',
1456 name => undef
1457 };
1458 }
1459 }
1460 # If backward, wipe history. Its their funeral.
1461 elsif ($num < @$test_results) {
1462 147 $#{$test_results} = $num - 1;
1463 }
1464 }
1465 }
1466 507 return release $ctx, $hub->count;
1467 }
1468  
1469  
1470 411 ▶sub is_passing {
Subroutine is_passing: called CC=3 SCAR=11.0
Pod documented
1471 411 my $self = shift;
1472  
1473 411 my $ctx = $self->ctx;
1474 411 my $hub = $ctx->hub;
1475  
1476 411 ▶ if( @_ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 264 147 411
1477 264 my ($bool) = @_;
1478 264 ▶ $hub->set_failed(0) if $bool;
Branch: 1 branch
BranchTrueFalseTotal
if $bool 255 9 264
1479 264 $hub->is_passing($bool);
1480 }
1481  
1482 411 return release $ctx, $hub->is_passing;
1483 }
1484  
1485  
1486 6 ▶sub summary {
Subroutine summary: called CC=3 SCAR=11.2
Pod documented
1487 6 my($self) = shift;
1488  
1489 6 ▶ return if $self->{no_log_results};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"no_log_results"} 0 6 6
1490  
1491 6 my $ctx = $self->ctx;
1492 6 my $data = $ctx->hub->meta(__PACKAGE__, {})->{Test_Results};
1493 6 $ctx->release;
1494 6 ▶ return map { $_ ? $_->{'ok'} : () } @$data;
Branch: 1 branch
BranchTrueFalseTotal
$_ ? : 14 0 14
1495 }
1496  
1497  
1498 5 ▶sub details {
Subroutine details: called CC=2 SCAR=6.9
Pod documented
1499 5 my $self = shift;
1500  
1501 5 ▶ return if $self->{no_log_results};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"no_log_results"} 2 3 5
1502  
1503 3 my $ctx = $self->ctx;
1504 3 my $data = $ctx->hub->meta(__PACKAGE__, {})->{Test_Results};
1505 3 $ctx->release;
1506 3 return @$data;
1507 }
1508  
1509  
1510 306 ▶sub find_TODO {
Subroutine find_TODO: called CC=5 SCAR=16.4
Pod documented
1511 306 my( $self, $pack, $set, $new_value ) = @_;
1512  
1513 306 my $ctx = $self->ctx;
1514  
1515 306 ▶ $pack ||= $ctx->trace->package || $self->exported_to;
Condition50%3/6
$pack ||= $ctx->trace->package || $self->exported_to
l!l&&r!l&&!r
1481580
$ctx->trace->package || $self->exported_to
l!l&&r!l&&!r
15800
MC/DC0%0/3
$pack ||= $ctx->trace->package || $self->exported_to
$pack $ctx->trace->package $self->exported_to
Truth table0%0/4
A ||= B || C
A= $packB= $ctx->trace->packageC= $self->exported_to
ABCresult
1XX1
01X1
0011
0000
1516 306 $ctx->release;
1517  
1518 306 ▶ return unless $pack;
Branch: 1 branch
BranchTrueFalseTotal
unless $pack 0 306 306
1519  
1520 183 ▶ no strict 'refs'; ## no critic
Subroutine BEGIN: called CC=1 SCAR=0.0
1521 183 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
1522 306 my $old_value = ${ $pack . '::TODO' };
1523 306 ▶ $set and ${ $pack . '::TODO' } = $new_value;
Branch: 1 branch
BranchTrueFalseTotal
$set and ${$pack . '::TODO';} = $new_value 306 0 306
1524 306 return $old_value;
1525 }
1526  
1527 29 ▶sub todo {
Subroutine todo: called CC=5 SCAR=16.2
Pod documented
1528 29 my( $self, $pack ) = @_;
1529  
1530 29 local $Level = $Level + 1;
1531 29 my $ctx = $self->ctx;
1532 29 $ctx->release;
1533  
1534 29 my $meta = $ctx->hub->meta(__PACKAGE__, {todo => []})->{todo};
1535 29 ▶ return $meta->[-1]->[1] if $meta && @$meta;
Branch: 1 branch
BranchTrueFalseTotal
if $meta and @$meta 5 24 29
Condition100%3/3
$meta and @$meta
!ll&&!rl&&r
2225
MC/DC100%2/2
$meta and @$meta
$meta @$meta
Truth table100%3/3
A and B
A= $metaB= @$meta
ABresult
0X0
100
111
1536  
1537 24 ▶ $pack ||= $ctx->trace->package;
Condition33%1/3
$pack ||= $ctx->trace->package
l!l&&r!l&&!r
0240
MC/DC0%0/2
$pack ||= $ctx->trace->package
$pack $ctx->trace->package
Truth table33%1/3
A ||= B
A= $packB= $ctx->trace->package
ABresult
1X1
011
000
1538  
1539 24 ▶ return unless $pack;
Branch: 1 branch
BranchTrueFalseTotal
unless $pack 0 24 24
1540  
1541 183 ▶ no strict 'refs'; ## no critic
Subroutine BEGIN: called CC=1 SCAR=0.0
1542 183 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
1543 24 return ${ $pack . '::TODO' };
1544 }
1545  
1546 496 ▶sub in_todo {
Subroutine in_todo: called CC=6 SCAR=17.9
Pod documented
1547 496 my $self = shift;
1548  
1549 496 local $Level = $Level + 1;
1550 496 my $ctx = $self->ctx;
1551 496 $ctx->release;
1552  
1553 496 my $meta = $ctx->hub->meta(__PACKAGE__, {todo => []})->{todo};
1554 496 ▶ return 1 if $meta && @$meta;
Branch: 1 branch
BranchTrueFalseTotal
if $meta and @$meta 164 332 496
Condition100%3/3
$meta and @$meta
!ll&&!rl&&r
27161164
MC/DC100%2/2
$meta and @$meta
$meta @$meta
Truth table100%3/3
A and B
A= $metaB= @$meta
ABresult
0X0
100
111
1555  
1556 332 ▶ my $pack = $ctx->trace->package || return 0;
Condition50%1/2
$ctx->trace->package || (return 0)
l!l
3320
MC/DC0%0/1
$ctx->trace->package || (return 0)
$ctx->trace->package
Truth table50%1/2
A
A= $ctx->trace->package
Aresult
11
00
1557  
1558 183 ▶ no strict 'refs'; ## no critic
Subroutine BEGIN: called CC=1 SCAR=0.0
1559 183 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
1560 332 my $todo = ${ $pack . '::TODO' };
1561  
1562 332 ▶ return 0 unless defined $todo;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $todo 243 89 332
1563 89 ▶ return 0 if "$todo" eq '';
Branch: 1 branch
BranchTrueFalseTotal
if "$todo" eq "" 2 87 89
1564 87 return 1;
1565 }
1566  
1567 90 ▶sub todo_start {
Subroutine todo_start: called CC=2 SCAR=6.9
Pod documented
1568 90 my $self = shift;
1569 90 ▶ my $message = @_ ? shift : '';
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 88 2 90
1570  
1571 90 my $ctx = $self->ctx;
1572  
1573 90 my $hub = $ctx->hub;
1574 729 ▶ my $filter = $hub->pre_filter(sub {
Subroutine __ANON__: called CC=7 SCAR=19.5
1575 729 my ($active_hub, $e) = @_;
1576  
1577 # Turn a diag into a todo diag
1578 729 ▶ return Test::Builder::TodoDiag->new(%$e) if ref($e) eq 'Test2::Event::Diag';
Branch: 1 branch
BranchTrueFalseTotal
if ref $e eq "Test2::Event::Diag" 294 435 729
1579  
1580 # Set todo on ok's
1581 435 ▶ if ($hub == $active_hub && $e->isa('Test2::Event::Ok')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hub == $active_hub and $e->isa("Test2::Event::Ok")) 176 259 435
Condition100%3/3
$hub == $active_hub and $e->isa("Test2::Event::Ok")
!ll&&!rl&&r
17188176
MC/DC100%2/2
$hub == $active_hub and $e->isa("Test2::Event::Ok")
$hub == $active_hub $e->isa("Test2::Event::Ok")
Truth table100%3/3
A and B
A= $hub == $active_hubB= $e->isa("Test2::Event::Ok")
ABresult
0X0
100
111
1582 176 $e->set_todo($message);
1583 176 $e->set_effective_pass(1);
1584  
1585 176 ▶ if (my $result = $e->get_meta(__PACKAGE__)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $result = $e->get_meta(__PACKAGE__)) 176 0 176
1586 176 ▶ $result->{reason} ||= $message;
Condition100%3/3
$result->{"reason"} ||= $message
l!l&&r!l&&!r
47597
MC/DC100%2/2
$result->{"reason"} ||= $message
$result->{"reason"} $message
Truth table100%3/3
A ||= B
A= $result->{"reason"}B= $message
ABresult
1X1
011
000
1587 176 ▶ $result->{type} ||= 'todo';
Condition100%2/2
$result->{"type"} ||= "todo"
l!l
4172
MC/DC100%1/1
$result->{"type"} ||= "todo"
$result->{"type"}
Truth table100%2/2
A
A= $result->{"type"}
Aresult
11
00
1588 176 $result->{ok} = 1;
1589 }
1590 }
1591  
1592 435 return $e;
1593 90 }, inherit => 1);
1594  
1595 90 push @{$ctx->hub->meta(__PACKAGE__, {todo => []})->{todo}} => [$filter, $message];
1596  
1597 90 $ctx->release;
1598  
1599 90 return;
1600 }
1601  
1602 91 ▶sub todo_end {
Subroutine todo_end: called CC=2 SCAR=6.9
Pod documented
1603 91 my $self = shift;
1604  
1605 91 my $ctx = $self->ctx;
1606  
1607 91 my $set = pop @{$ctx->hub->meta(__PACKAGE__, {todo => []})->{todo}};
1608  
1609 91 ▶ $ctx->throw('todo_end() called without todo_start()') unless $set;
Branch: 1 branch
BranchTrueFalseTotal
unless $set 1 90 91
1610  
1611 90 $ctx->hub->pre_unfilter($set->[0]);
1612  
1613 90 $ctx->release;
1614  
1615 90 return;
1616 }
1617  
1618  
1619 342 ▶sub caller { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
Subroutine caller: called CC=2 SCAR=7.0
Pod documented
1620 342 my( $self ) = @_;
1621  
1622 342 my $ctx = $self->ctx;
1623  
1624 342 my $trace = $ctx->trace;
1625 342 $ctx->release;
1626 342 ▶ return wantarray ? $trace->call : $trace->package;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 342 0 342
1627 }
1628  
1629  
1630 566 ▶sub _try {
Subroutine _try: called CC=4 SCAR=13.9
1631 566 my( $self, $code, %opts ) = @_;
1632  
1633 566 my $error;
1634 my $return;
1635 {
1636 566 local $!; # eval can mess up $!
1637 566 local $@; # don't set $@ in the test
1638 566 local $SIG{__DIE__}; # don't trip an outside DIE handler.
1639 566 $return = eval { $code->() };
1640 566 $error = $@;
1641 }
1642  
1643 566 ▶ die $error if $error and $opts{die_on_fail};
Branch: 1 branch
BranchTrueFalseTotal
if $error and $opts{"die_on_fail"} 1 565 566
Condition100%3/3
$error and $opts{"die_on_fail"}
!ll&&!rl&&r
774881
MC/DC100%2/2
$error and $opts{"die_on_fail"}
$error $opts{"die_on_fail"}
Truth table100%3/3
A and B
A= $errorB= $opts{"die_on_fail"}
ABresult
0X0
100
111
1644  
1645 565 ▶ return wantarray ? ( $return, $error ) : $return;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 44 521 565
1646 }
1647  
1648 168 ▶sub _ending {
Subroutine _ending: called CC=41 SCAR=40.0
1649 168 my $self = shift;
1650 168 my ($ctx, $real_exit_code, $new) = @_;
1651  
1652 168 ▶ unless ($ctx) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ctx) 9 159 168
1653 9 my $octx = $self->ctx;
1654 9 $ctx = $octx->snapshot;
1655 9 $octx->release;
1656 }
1657  
1658 168 ▶ return if $ctx->hub->no_ending;
Branch: 1 branch
BranchTrueFalseTotal
if $ctx->hub->no_ending 0 168 168
1659 168 ▶ return if $ctx->hub->meta(__PACKAGE__, {})->{Ending}++;
Branch: 1 branch
BranchTrueFalseTotal
if $ctx->hub->meta(__PACKAGE__, {})->{"Ending"}++ 0 168 168
1660  
1661 # Don't bother with an ending if this is a forked copy. Only the parent
1662 # should do the ending.
1663 168 ▶ return unless $self->{Original_Pid} == $$;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Original_Pid"} == $$ 0 168 168
1664  
1665 168 my $hub = $ctx->hub;
1666 168 ▶ return if $hub->bailed_out;
Branch: 1 branch
BranchTrueFalseTotal
if $hub->bailed_out 0 168 168
1667  
1668 168 my $plan = $hub->plan;
1669 168 my $count = $hub->count;
1670 168 my $failed = $hub->failed;
1671 168 my $passed = $hub->is_passing;
1672 168 ▶ return unless $plan || $count || $failed;
Branch: 1 branch
BranchTrueFalseTotal
unless $plan or $count or $failed 5 163 168
Condition83%5/6
$plan or $count or $failed
l!l&&r!l&&!r
16305
$plan or $count
l!l&&r!l&&!r
16035
MC/DC66%2/3
$plan or $count or $failed
$plan $count $failed
Truth table75%3/4
A or B or C
A= $planB= $countC= $failed
ABCresult
1XX1
01X1
0011
0000
1673  
1674 # Ran tests but never declared a plan or hit done_testing
1675 163 ▶ if( !defined($hub->plan) and $hub->count ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $hub->plan and $hub->count) 3 160 163
Condition66%2/3
not defined $hub->plan and $hub->count
!ll&&!rl&&r
16003
MC/DC50%1/2
not defined $hub->plan and $hub->count
not defined $hub->plan $hub->count
Truth table66%2/3
not(A) and B
A= not defined $hub->planB= $hub->count
ABresult
0X0
100
111
1676 3 $self->diag("Tests were run but no plan was declared and done_testing() was not seen.");
1677  
1678 3 ▶ if($real_exit_code) {
Branch: 1 branch
BranchTrueFalseTotal
if ($real_exit_code) 0 3 3
1679 0 $self->diag(<<"FAIL");
1680 Looks like your test exited with $real_exit_code just after $count.
1681 FAIL
1682 0 ▶ $$new ||= $real_exit_code;
Condition0%0/3
$$new ||= $real_exit_code
l!l&&r!l&&!r
000
MC/DC0%0/2
$$new ||= $real_exit_code
$$new $real_exit_code
Truth table0%0/3
A ||= B
A= $$newB= $real_exit_code
ABresult
1X1
011
000
1683 0 return;
1684 }
1685  
1686 # But if the tests ran, handle exit code.
1687 3 ▶ if($failed > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($failed > 0) 1 2 3
1688 1 ▶ my $exit_code = $failed <= 254 ? $failed : 254;
Branch: 1 branch
BranchTrueFalseTotal
$failed <= 254 ? : 1 0 1
1689 1 ▶ $$new ||= $exit_code;
Condition33%1/3
$$new ||= $exit_code
l!l&&r!l&&!r
010
MC/DC0%0/2
$$new ||= $exit_code
$$new $exit_code
Truth table33%1/3
A ||= B
A= $$newB= $exit_code
ABresult
1X1
011
000
1690 1 return;
1691 }
1692  
1693 2 ▶ $$new ||= 254;
Condition50%1/2
$$new ||= 254
l!l
02
MC/DC0%0/1
$$new ||= 254
$$new
Truth table50%1/2
A
A= $$new
Aresult
11
00
1694 2 return;
1695 }
1696  
1697 160 ▶ if ($real_exit_code && !$count) {
Branch: 1 branch
BranchTrueFalseTotal
if ($real_exit_code and not $count) 1 159 160
Condition100%3/3
$real_exit_code and not $count
!ll&&!rl&&r
15631
MC/DC100%2/2
$real_exit_code and not $count
$real_exit_code not $count
Truth table100%3/3
A and not(B)
A= $real_exit_codeB= not $count
ABresult
0X0
100
111
1698 1 $self->diag("Looks like your test exited with $real_exit_code before it could output anything.");
1699 1 ▶ $$new ||= $real_exit_code;
Condition33%1/3
$$new ||= $real_exit_code
l!l&&r!l&&!r
100
MC/DC0%0/2
$$new ||= $real_exit_code
$$new $real_exit_code
Truth table33%1/3
A ||= B
A= $$newB= $real_exit_code
ABresult
1X1
011
000
1700 1 return;
1701 }
1702  
1703 159 ▶ return if $plan && "$plan" eq 'SKIP';
Branch: 1 branch
BranchTrueFalseTotal
if $plan and "$plan" eq "SKIP" 8 151 159
Condition66%2/3
$plan and "$plan" eq "SKIP"
!ll&&!rl&&r
01518
MC/DC50%1/2
$plan and "$plan" eq "SKIP"
$plan "$plan" eq "SKIP"
Truth table66%2/3
A and B
A= $planB= "$plan" eq "SKIP"
ABresult
0X0
100
111
1704  
1705 151 ▶ if (!$count) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($count) 1 150 151
1706 1 $self->diag('No tests run!');
1707 1 ▶ $$new ||= 255;
Condition50%1/2
$$new ||= 255
l!l
01
MC/DC0%0/1
$$new ||= 255
$$new
Truth table50%1/2
A
A= $$new
Aresult
11
00
1708 1 return;
1709 }
1710  
1711 150 ▶ if ($real_exit_code) {
Branch: 1 branch
BranchTrueFalseTotal
if ($real_exit_code) 3 147 150
1712 3 $self->diag(<<"FAIL");
1713 Looks like your test exited with $real_exit_code just after $count.
1714 FAIL
1715 3 ▶ $$new ||= $real_exit_code;
Condition33%1/3
$$new ||= $real_exit_code
l!l&&r!l&&!r
300
MC/DC0%0/2
$$new ||= $real_exit_code
$$new $real_exit_code
Truth table33%1/3
A ||= B
A= $$newB= $real_exit_code
ABresult
1X1
011
000
1716 3 return;
1717 }
1718  
1719 147 ▶ if ($plan eq 'NO PLAN') {
Branch: 1 branch
BranchTrueFalseTotal
if ($plan eq "NO PLAN") 3 144 147
1720 3 $ctx->plan( $count );
1721 3 $plan = $hub->plan;
1722 }
1723  
1724 # Figure out if we passed or failed and print helpful messages.
1725 147 my $num_extra = $count - $plan;
1726  
1727 147 ▶ if ($num_extra != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($num_extra != 0) 7 140 147
1728 7 ▶ my $s = $plan == 1 ? '' : 's';
Branch: 1 branch
BranchTrueFalseTotal
$plan == 1 ? : 2 5 7
1729 7 $self->diag(<<"FAIL");
1730 Looks like you planned $plan test$s but ran $count.
1731 FAIL
1732 }
1733  
1734 147 ▶ if ($failed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($failed) 12 135 147
1735 12 ▶ my $s = $failed == 1 ? '' : 's';
Branch: 1 branch
BranchTrueFalseTotal
$failed == 1 ? : 4 8 12
1736  
1737 12 ▶ my $qualifier = $num_extra == 0 ? '' : ' run';
Branch: 1 branch
BranchTrueFalseTotal
$num_extra == 0 ? : 7 5 12
1738  
1739 12 $self->diag(<<"FAIL");
1740 Looks like you failed $failed test$s of $count$qualifier.
1741 FAIL
1742 }
1743  
1744 147 ▶ if (!$passed && !$failed && $count && !$num_extra) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $passed || $failed and $count and not $num_extra) 0 147 147
Condition77%7/9
not $passed || $failed and $count and not $num_extra
!ll&&!rl&&r
14520
not $passed || $failed and $count
!ll&&!rl&&r
14502
$passed || $failed
l!l&&r!l&&!r
133122
MC/DC0%0/4
not $passed || $failed and $count and not $num_extra
$passed $failed $count not $num_extra
Truth table60%3/5
not(A || B) and C and not(D)
A= $passedB= $failedC= $countD= not $num_extra
ABCDresult
1XXX0
01XX0
000X0
00100
00111
1745 0 $ctx->diag(<<"FAIL");
1746 All assertions passed, but errors were encountered.
1747 FAIL
1748 }
1749  
1750 147 my $exit_code = 0;
1751 147 ▶ if ($failed) {
Branch: 3 branches
BranchTrueFalseTotal
if ($failed) { } 12 135 147
elsif ($num_extra != 0) { } 2 133 135
elsif (not $passed) { } 0 133 133
1752 12 ▶ $exit_code = $failed <= 254 ? $failed : 254;
Branch: 1 branch
BranchTrueFalseTotal
$failed <= 254 ? : 12 0 12
1753 }
1754 elsif ($num_extra != 0) {
1755 2 $exit_code = 255;
1756 }
1757 elsif (!$passed) {
1758 0 $exit_code = 255;
1759 }
1760  
1761 147 ▶ $$new ||= $exit_code;
Condition66%2/3
$$new ||= $exit_code
l!l&&r!l&&!r
014133
MC/DC50%1/2
$$new ||= $exit_code
$$new $exit_code
Truth table66%2/3
A ||= B
A= $$newB= $exit_code
ABresult
1X1
011
000
1762 147 return;
1763 }
1764  
1765 # Some things used this even though it was private... I am looking at you
1766 # Test::Builder::Prefix...
1767 0 ▶sub _print_comment {
Subroutine _print_comment: not called CC=5 SCAR=34.0
1768 0 my( $self, $fh, @msgs ) = @_;
1769  
1770 0 ▶ return if $self->no_diag;
Branch: 1 branch
BranchTrueFalseTotal
if $self->no_diag 0 0 0
1771 0 ▶ return unless @msgs;
Branch: 1 branch
BranchTrueFalseTotal
unless @msgs 0 0 0
1772  
1773 # Prevent printing headers when compiling (i.e. -c)
1774 0 ▶ return if $^C;
Branch: 1 branch
BranchTrueFalseTotal
if $^C 0 0 0
1775  
1776 # Smash args together like print does.
1777 # Convert undef to 'undef' so its readable.
1778 0 ▶ my $msg = join '', map { defined($_) ? $_ : 'undef' } @msgs;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
1779  
1780 # Escape the beginning, _print will take care of the rest.
1781 0 $msg =~ s/^/# /;
1782  
1783 0 local( $\, $", $, ) = ( undef, ' ', '' );
1784 0 print $fh $msg;
1785  
1786 0 return 0;
1787 }
1788  
1789 # This is used by Test::SharedFork to turn on IPC after the fact. Not
1790 # documenting because I do not want it used. The method name is borrowed from
1791 # Test::Builder 2
1792 # Once Test2 stuff goes stable this method will be removed and Test::SharedFork
1793 # will be made smarter.
1794 0 ▶sub coordinate_forks {
Subroutine coordinate_forks: not called CC=1 SCAR=6.9
Pod undocumented
1795 0 my $self = shift;
1796  
1797 {
1798 0 local ($@, $!);
1799 0 require Test2::IPC;
1800 }
1801 0 Test2::IPC->import;
1802 0 Test2::API::test2_ipc_enable_polling();
1803 0 Test2::API::test2_load();
1804 0 my $ipc = Test2::IPC::apply_ipc($self->{Stack});
1805 0 $ipc->set_no_fatal(1);
1806 0 Test2::API::test2_no_wait(1);
1807 }
1808  
1809 2 ▶sub no_log_results { $_[0]->{no_log_results} = 1 }
Subroutine no_log_results: called CC=1 SCAR=0.0
Pod documented
1810  
1811 183 1;
1812  
1813 __END__
« blib/lib/Test2/API/Breakage.pm ↑ Summary blib/lib/Test2/AsyncSubtest.pm »