Branch Coverage

blib/lib/Test/Builder.pm
Criterion Covered Total %
branch 354 436 81.1


line true false branch
10 0 162 if ($] < 5.008)
21 2 160 if Test2::API::test2_init_done() or Test2::API::test2_load_done()
59 4416 0 $e->{'trace'} ? :
64 4416 0 if $cpkg
65 2961 1455 if $epkg and not $todo
67 4092 324 unless defined $todo
68 2 322 unless length $todo
71 114 208 if ref $e eq 'Test2::Event::Diag'
73 133 75 if $e->can('set_todo')
77 133 75 if ($e->isa('Test2::Event::Ok'))
80 131 2 if (my $result = $e->get_meta('Test::Builder'))
106 23 0 if $cpkg
107 13 10 if $epkg
109 23 0 if $cpkg
110 13 10 if $epkg
134 150 1 unless Test2::API::test2_in_preload()
140 157 1979 unless ($Test)
145 157 0 if not $Test::Builder::Test->{'Original_Pid'} or $Test::Builder::Test->{'Original_Pid'} == 0
158 0 157 if Test2::API::test2_has_ipc()
168 162 47 if ($params{'singleton'}) { }
207 1 147 unless $parent
225 0 151 if $pmeta->{'child'}
242 36 78 if ref $e eq 'Test2::Event::Diag'
245 25 126 if $orig_TODO
260 145 6 $parent->format ? :
271 137 10 if @_
277 0 147 if ($meta->{'child'})
292 87 4 if $ok and $chub->count and not $chub->no_ending and not $chub->ended
303 14 133 $plan =~ /\D/ ? :
304 12 135 if ($count and $num_extra != 0)
305 0 12 $plan == 1 ? :
311 61 86 if ($failed)
312 49 12 $failed == 1 ? :
314 49 12 $num_extra == 0 ? :
321 0 13 if (not $passed || $failed and $count and not $num_extra)
329 147 0 unless ($chub->bailed_out)
331 2 145 if ($plan and $plan eq 'SKIP') { }
54 91 elsif (not $chub->count) { }
354 2 140 unless $code and &reftype($code) eq 'CODE'
378 0 135 if (not $ok and $err =~ /Label not found for "last T2_SUBTEST_WRAPPER"/ or &blessed($err) and &blessed($err) eq 'Test::Builder::Exception') { }
387 0 139 if ($start_pid != $$ and not $INC{'Test2/IPC.pm'})
388 0 0 $ok ? :
394 4 135 unless ($finished)
395 2 2 if (my $bailed = $st_ctx->hub->bailed_out)
402 0 2 if $code
409 50 2 if (not $count and !defined($plan) || "$plan" ne 'SKIP')
410 13 37 unless defined $plan
418 1 136 unless $ok
420 134 2 if defined $child_error
441 0 55 $ENV{'TEST_NO_LOG_RESULTS'} ? :
55 162 unless $params{'singleton'}
443 0 217 Test2::API::test2_in_preload() ? :
448 55 162 unless ($params{'singleton'})
465 55 162 unless $params{'singleton'}
470 208 1 if ($format and $format->isa('Test2::Formatter::TAP'))
473 208 1 $out ? :
477 55 162 unless $params{'singleton'}
478 55 162 unless $params{'singleton'}
496 74 208 unless $cmd
501 2 206 if $hub->plan
505 203 3 if (my $method = $plan_cmds{$cmd}) { }
523 163 3 if ($arg) { }
1 2 elsif (not defined $arg) { }
544 163 89 if (@_)
545 4 159 unless $max =~ /^\+?\d+$/
556 46 202 unless $plan
557 1 201 if $plan =~ /\D/
567 1 26 if (defined $ctx->hub->plan)
573 1 25 if $arg
588 2 66 if ($meta->{'Done_Testing'})
601 19 47 if (defined $num_tests) { }
0 47 elsif ($count and defined $num_tests and $count != $num_tests) { }
602 17 2 if not $plan or $plan eq 'NO PLAN'
611 2 64 if ($self->expected_tests and $num_tests != $self->expected_tests)
616 1 65 if $ctx->hub->plan and $ctx->hub->plan eq 'NO PLAN'
631 4 7 if $plan and not $plan =~ /\D/
632 5 2 if $plan and $plan eq 'NO PLAN'
645 0 12 if ($] < 5.02)
649 0 0 unless @call and $call[0]
650 0 0 unless $call[3] =~ /::BEGIN$/
655 0 0 if $begin and $ctx->hub->meta('Test::Builder', {})->{'parent'}
665 141 110 if (defined $pack)
679 1654 476 $test ? :
683 1761 369 if defined $name
687 1 2129 if 0 + $name and $name =~ /^[\d\s]+$/
696 1761 369 defined $name ? :
704 2124 6 unless $self->{'no_log_results'}
714 88 2042 if ($subevents)
729 476 1654 unless $test
741 250 226 $is_todo ? :
744 447 29 if (defined $orig_name) { }
755 0 0 $self->in_todo ? :
761 146 500 unless ref $$thing
762 455 0 unless &blessed($$thing) or scalar $self->_try(sub {
783 22 1 unless $self->_is_dualvar($$val)
793 0 23 if ref $val
808 13 493 unless (defined $got and defined $expect)
813 4 9 unless $test
827 1 64 unless (defined $got and defined $expect)
832 0 1 unless $test
844 46 5 if (defined $$val) { }
845 35 11 if ($type eq 'eq' or $type eq 'ne') { }
893 4 7 unless (defined $got and defined $dont_expect)
898 1 3 unless $test
911 1 1 unless (defined $got and defined $dont_expect)
916 0 1 unless $test
953 2 599 if ($cmp_ok_bl{$type})
982 80 519 $numeric_cmps{$type} ? :
986 3 596 unless $succ
993 28 571 unless ($ok)
996 19 9 if ($type =~ /^(eq|==)$/) { }
6 3 elsif ($type =~ /^(ne|!=)$/) { }
1008 2 4 if ($eq) { }
1025 3 2 defined $got ? :
1026 5 0 defined $expect ? :
1042 319 0 if defined $file and defined $line
1067 15 2 unless defined $name
1078 17 0 unless $self->{'no_log_results'}
1103 6 0 unless $self->{'no_log_results'}
1117 1 326 unless defined $regex
1122 302 24 if (_is_qr($regex)) { }
22 2 elsif (($re, $opts) = $regex =~ m[^ /(.*)/ (\w*) $ ]sx or (undef, $re, $opts) = $regex =~ /^ m([^\w\s]) (.+) \1 (\w*) $/sx) { }
1130 3 19 length $opts ? :
1141 326 0 if defined &re::is_regexp
1150 1 319 unless (defined $usable_regex)
1172 5 314 if $cmp eq '!~'
1178 5 314 unless ($ok)
1179 5 0 defined $thing ? :
1180 4 1 $cmp eq '=~' ? :
1197 1 1166 unless defined $maybe_fh
1199 984 182 if ref $maybe_fh eq 'GLOB'
1200 2 180 if ref \$maybe_fh eq 'GLOB'
1210 18 2 if (defined $level)
1222 0 218 unless ($format and $format->can('no_numbers') and $format->can('set_no_numbers'))
1223 0 3 if $format
1227 217 1 if defined $use_nums
1229 2 216 $format->no_numbers ? :
1240 1 60 unless ($format and $format->can($set))
1241 0 1 if $format
1246 58 2 if defined $no
1248 5 55 $format->$method ? :
1261 197 1 if defined $no
1268 8 608 unless @_
1270 612 1 defined $_ ? :
1272 1 607 if (Test2::API::test2_in_preload())
1288 0 13 unless @_
1290 14 0 defined $_ ? :
1292 1 12 if (Test2::API::test2_in_preload())
1314 4 5 ref $_ ? :
1317 4 0 if $dumper->can('Sortkeys')
1331 0 491 unless $format and $format->isa('Test2::Formatter::TAP')
1333 339 152 if defined $fh
1345 0 484 unless $format and $format->isa('Test2::Formatter::TAP')
1347 332 152 if defined $fh
1359 0 482 unless $format and $format->isa('Test::Builder::Formatter')
1361 330 152 if defined $fh
1372 986 171 if ($self->is_fh($file_or_fh)) { }
170 1 elsif (ref $file_or_fh eq 'SCALAR') { }
1377 170 0 if ($] >= 5.008) { }
1378 0 170 unless open $fh, '>>', $file_or_fh
1383 0 0 unless $fh = 'Test::Builder::IO::Scalar'->new($file_or_fh)
1388 0 1 unless open $fh, '>', $file_or_fh
1412 2 219 unless $format and $format->isa('Test2::Formatter::TAP')
1413 219 0 if $self->{'Orig_Handles'}
1440 307 199 if (defined $num)
1443 307 0 unless ($self->{'no_log_results'})
1446 136 171 if ($num > @$test_results) { }
147 24 elsif ($num < @$test_results) { }
1447 130 6 @$test_results ? :
1474 264 147 if (@_)
1476 255 9 if $bool
1487 0 6 if $self->{'no_log_results'}
1492 14 0 $_ ? :
1499 2 3 if $self->{'no_log_results'}
1516 0 298 unless $pack
1521 298 0 if $set
1533 5 24 if $meta and @$meta
1537 0 24 unless $pack
1552 164 314 if $meta and @$meta
1560 225 89 unless defined $todo
1561 2 87 if "$todo" eq ''
1567 88 2 @_ ? :
1576 294 435 if ref $e eq 'Test2::Event::Diag'
1579 176 259 if ($hub == $active_hub and $e->isa('Test2::Event::Ok'))
1583 176 0 if (my $result = $e->get_meta('Test::Builder'))
1607 1 90 unless $set
1624 340 0 wantarray ? :
1641 1 466 if $error and $opts{'die_on_fail'}
1643 44 499 wantarray ? :
1650 9 140 unless ($ctx)
1656 0 149 if $ctx->hub->no_ending
1657 0 149 if $ctx->hub->meta('Test::Builder', {})->{'Ending'}++
1661 0 149 unless $self->{'Original_Pid'} == $$
1664 0 149 if $hub->bailed_out
1670 3 1 unless $plan or $count or $failed
1673 1 145 if (not $hub->plan and $hub->count)
1676 0 1 if ($real_exit_code)
1685 0 1 if ($failed > 0)
1686 0 0 $failed <= 254 ? :
1695 1 144 if ($real_exit_code and not $count)
1701 8 136 if $plan and "$plan" eq 'SKIP'
1703 1 135 unless ($count)
1709 0 135 if ($real_exit_code)
1717 3 132 if ($plan eq 'NO PLAN')
1725 4 131 if ($num_extra != 0)
1726 2 2 $plan == 1 ? :
1732 7 128 if ($failed)
1733 3 4 $failed == 1 ? :
1735 4 3 $num_extra == 0 ? :
1742 0 1 if (not $passed || $failed and $count and not $num_extra)
1749 7 128 if ($failed) { }
1 127 elsif ($num_extra != 0) { }
0 127 elsif (not $passed) { }
1750 7 0 $failed <= 254 ? :
1768 0 0 if $self->no_diag
1769 0 0 unless @msgs
1772 0 0 if $^C
1776 0 0 defined $_ ? :