Branch Coverage

inc/Test/Builder.pm
Criterion Covered Total %
branch 80 440 18.1


line true false branch
10 0 8 if ($] < "5.008")
21 0 8 if Test2::API::test2_init_done() or Test2::API::test2_load_done()
59 64 0 $e->{'trace'} ? :
64 64 0 if $cpkg
65 64 0 if $epkg and not $todo
67 64 0 unless defined $todo
68 0 0 unless length $todo
71 0 0 if ref $e eq "Test2::Event::Diag"
73 0 0 if $e->can("set_todo")
77 0 0 if ($e->isa("Test2::Event::Ok"))
80 0 0 if (my $result = $e->get_meta(__PACKAGE__))
106 0 0 if $cpkg
107 0 0 if $epkg
109 0 0 if $cpkg
110 0 0 if $epkg
134 8 0 unless Test2::API::test2_in_preload()
140 8 105 unless ($Test)
145 8 0 if not $Test::Builder::Test->{'Original_Pid'} or $Test::Builder::Test->{'Original_Pid'} == 0
158 0 8 if Test2::API::test2_has_ipc()
168 8 0 if ($params{'singleton'}) { }
207 0 0 unless $parent
225 0 0 if $pmeta->{'child'}
242 0 0 if ref $e eq "Test2::Event::Diag"
245 0 0 if $orig_TODO
260 0 0 $parent->format ? :
271 0 0 if @_
277 0 0 if ($meta->{'child'})
292 0 0 if $ok and $chub->count and not $chub->no_ending and not $chub->ended
303 0 0 $plan =~ /\D/ ? :
304 0 0 if ($count and $num_extra != 0)
305 0 0 $plan == 1 ? :
311 0 0 if ($failed)
312 0 0 $failed == 1 ? :
314 0 0 $num_extra == 0 ? :
321 0 0 if (not $passed || $failed and $count and not $num_extra)
329 0 0 unless ($chub->bailed_out)
331 0 0 if ($plan and $plan eq 'SKIP') { }
0 0 elsif (not $chub->count) { }
354 0 0 unless $code and builtin::reftype($code) eq "CODE"
378 0 0 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') { }
387 0 0 if ($start_pid != $$ and not $INC{'Test2/IPC.pm'})
388 0 0 $ok ? :
394 0 0 unless ($finished)
395 0 0 if (my $bailed = $st_ctx->hub->bailed_out)
402 0 0 if $code
409 0 0 if (not $count and !defined($plan) || "$plan" ne 'SKIP')
410 0 0 unless defined $plan
418 0 0 unless $ok
420 0 0 if defined $child_error
441 0 0 $ENV{'TEST_NO_LOG_RESULTS'} ? :
0 8 unless $params{'singleton'}
443 0 8 Test2::API::test2_in_preload() ? :
448 0 8 unless ($params{'singleton'})
465 0 8 unless $params{'singleton'}
470 8 0 if ($format and $format->isa("Test2::Formatter::TAP"))
473 8 0 $out ? :
477 0 8 unless $params{'singleton'}
478 0 8 unless $params{'singleton'}
496 3 3 unless $cmd
501 0 3 if $hub->plan
505 3 0 if (my $method = $plan_cmds{$cmd}) { }
523 7 0 if ($arg) { }
0 0 elsif (not defined $arg) { }
544 7 0 if (@_)
545 0 7 unless $max =~ /^\+?\d+$/
556 0 7 unless $plan
557 0 7 if $plan =~ /\D/
567 0 0 if (defined $ctx->hub->plan)
573 0 0 if $arg
588 0 0 if ($meta->{'Done_Testing'})
601 0 0 if (defined $num_tests) { }
0 0 elsif ($count and defined $num_tests and $count != $num_tests) { }
602 0 0 if not $plan or $plan eq "NO PLAN"
611 0 0 if ($self->expected_tests and $num_tests != $self->expected_tests)
616 0 0 if $ctx->hub->plan and $ctx->hub->plan eq "NO PLAN"
631 0 0 if $plan and not $plan =~ /\D/
632 0 0 if $plan and $plan eq "NO PLAN"
645 0 1 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(__PACKAGE__, {})->{'parent'}
658 1 0 if defined $reason
667 13 8 if (defined $pack)
681 49 0 $test ? :
685 49 0 if defined $name
689 0 49 if 0 + $name and $name =~ /^[\d\s]+$/
698 49 0 defined $name ? :
706 49 0 unless $self->{'no_log_results'}
716 0 49 if ($subevents)
731 0 49 unless $test
743 0 0 $is_todo ? :
746 0 0 if (defined $orig_name) { }
757 0 0 $self->in_todo ? :
763 0 130 unless ref $$thing
764 130 0 unless builtin::blessed($$thing) or scalar $self->_try(sub { $$thing->isa("UNIVERSAL"); } )
785 0 0 unless $self->_is_dualvar($$val)
795 0 0 if ref $val
810 0 5 unless (defined $got and defined $expect)
815 0 0 unless $test
829 0 0 unless (defined $got and defined $expect)
834 0 0 unless $test
846 0 0 if (defined $$val) { }
847 0 0 if ($type eq 'eq' or $type eq 'ne') { }
895 0 0 unless (defined $got and defined $dont_expect)
900 0 0 unless $test
913 0 0 unless (defined $got and defined $dont_expect)
918 0 0 unless $test
955 0 5 if ($cmp_ok_bl{$type})
970 5 0 defined $warning_bits ? :
987 0 5 $numeric_cmps{$type} ? :
991 0 5 unless $succ
998 0 5 unless ($ok)
1001 0 0 if ($type =~ /^(eq|==)$/) { }
0 0 elsif ($type =~ /^(ne|!=)$/) { }
1005 0 0 if (defined $got xor defined $expect) { }
1022 0 0 defined $got ? :
1023 0 0 defined $expect ? :
1039 7 0 if defined $file and defined $line
1064 0 0 unless defined $name
1082 0 0 unless $self->{'no_log_results'}
1103 0 0 unless $self->{'no_log_results'}
1117 0 7 unless defined $regex
1122 7 0 if (_is_qr($regex)) { }
0 0 elsif (($re, $opts) = $regex =~ m[^ /(.*)/ (\w*) $ ]sx or (undef, $re, $opts) = $regex =~ /^ m([^\w\s]) (.+) \1 (\w*) $/sx) { }
1130 0 0 length $opts ? :
1141 7 0 if defined &re::is_regexp
1150 0 7 unless (defined $usable_regex)
1172 0 7 if $cmp eq "!~"
1178 0 7 unless ($ok)
1179 0 0 defined $thing ? :
1180 0 0 $cmp eq '=~' ? :
1197 0 0 unless defined $maybe_fh
1199 0 0 if ref $maybe_fh eq "GLOB"
1200 0 0 if ref \$maybe_fh eq "GLOB"
1210 0 0 if (defined $level)
1222 0 8 unless ($format and $format->can("no_numbers") and $format->can("set_no_numbers"))
1223 0 0 if $format
1227 8 0 if defined $use_nums
1229 0 8 $format->no_numbers ? :
1240 0 0 unless ($format and $format->can($set))
1241 0 0 if $format
1246 0 0 if defined $no
1248 0 0 $format->$method ? :
1261 0 0 if defined $no
1268 0 0 unless @_
1270 0 0 defined $_ ? :
1272 0 0 if (Test2::API::test2_in_preload())
1288 0 0 unless @_
1290 0 0 defined $_ ? :
1292 0 0 if (Test2::API::test2_in_preload())
1314 0 0 if (ref $_) { }
1317 0 0 if $dumper->can("Sortkeys")
1331 0 0 unless $format and $format->isa("Test2::Formatter::TAP")
1333 0 0 if defined $fh
1345 0 0 unless $format and $format->isa("Test2::Formatter::TAP")
1347 0 0 if defined $fh
1359 0 0 unless $format and $format->isa("Test::Builder::Formatter")
1361 0 0 if defined $fh
1372 0 0 if ($self->is_fh($file_or_fh)) { }
0 0 elsif (ref $file_or_fh eq 'SCALAR') { }
1377 0 0 if ($] >= 5.008) { }
1378 0 0 unless open $fh, ">>", $file_or_fh
1383 0 0 unless $fh = "Test::Builder::IO::Scalar"->new($file_or_fh)
1388 0 0 unless open $fh, ">", $file_or_fh
1412 0 8 unless $format and $format->isa("Test2::Formatter::TAP")
1413 8 0 if $self->{'Orig_Handles'}
1440 0 0 if (defined $num)
1443 0 0 unless ($self->{'no_log_results'})
1446 0 0 if ($num > @$test_results) { }
0 0 elsif ($num < @$test_results) { }
1447 0 0 @$test_results ? :
1474 0 0 if (@_)
1476 0 0 if $bool
1487 0 0 if $self->{'no_log_results'}
1492 0 0 $_ ? :
1499 0 0 if $self->{'no_log_results'}
1516 0 0 unless $pack
1521 0 0 if $set
1533 0 0 if $meta and @$meta
1537 0 0 unless $pack
1552 0 0 if $meta and @$meta
1560 0 0 unless defined $todo
1561 0 0 if "$todo" eq ""
1567 0 0 @_ ? :
1576 0 0 if ref $e eq "Test2::Event::Diag"
1579 0 0 if ($hub == $active_hub and $e->isa("Test2::Event::Ok"))
1583 0 0 if (my $result = $e->get_meta(__PACKAGE__))
1607 0 0 unless $set
1624 7 0 wantarray ? :
1641 0 130 if $error and $opts{'die_on_fail'}
1643 0 130 wantarray ? :
1650 0 8 unless ($ctx)
1656 0 8 if $ctx->hub->no_ending
1657 0 8 if $ctx->hub->meta(__PACKAGE__, {})->{'Ending'}++
1661 0 8 unless $self->{'Original_Pid'} == $$
1664 0 8 if $hub->bailed_out
1670 0 0 unless $plan or $count or $failed
1673 0 8 if (not $hub->plan and $hub->count)
1676 0 0 if ($real_exit_code)
1685 0 0 if ($failed > 0)
1686 0 0 $failed <= 254 ? :
1695 0 8 if ($real_exit_code and not $count)
1701 1 7 if $plan and "$plan" eq "SKIP"
1703 0 7 unless ($count)
1709 0 7 if ($real_exit_code)
1717 0 7 if ($plan eq "NO PLAN")
1725 0 7 if ($num_extra != 0)
1726 0 0 $plan == 1 ? :
1732 0 7 if ($failed)
1733 0 0 $failed == 1 ? :
1735 0 0 $num_extra == 0 ? :
1742 0 0 if (not $passed || $failed and $count and not $num_extra)
1749 0 7 if ($failed) { }
0 7 elsif ($num_extra != 0) { }
0 7 elsif (not $passed) { }
1750 0 0 $failed <= 254 ? :
1768 0 0 if $self->no_diag
1769 0 0 unless @msgs
1772 0 0 if $^C
1776 0 0 defined $_ ? :