Branch Coverage

inc/Test/Builder.pm
Criterion Covered Total %
branch 71 428 16.5


line true false branch
10 0 6 if ($] < "5.008")
21 0 6 if Test2::API::test2_init_done() or Test2::API::test2_load_done()
58 22 0 $e->{'trace'} ? :
63 22 0 if $cpkg
64 22 0 if $epkg and not $todo
66 22 0 unless defined $todo
67 0 0 unless length $todo
70 0 0 if ref $e eq "Test2::Event::Diag"
72 0 0 if $e->can("set_todo")
76 0 0 if ($e->isa("Test2::Event::Ok"))
79 0 0 if (my $result = $e->get_meta("Test::Builder"))
94 6 0 unless Test2::API::test2_in_preload()
100 6 30 unless ($Test)
105 6 0 if not $Test::Builder::Test->{'Original_Pid'} or $Test::Builder::Test->{'Original_Pid'} == 0
118 0 6 if Test2::API::test2_has_ipc()
128 6 0 if ($params{'singleton'}) { }
167 0 0 unless $parent
185 0 0 if $pmeta->{'child'}
202 0 0 if ref $e eq "Test2::Event::Diag"
205 0 0 if $orig_TODO
220 0 0 $parent->format ? :
231 0 0 if @_
237 0 0 if ($meta->{'child'})
252 0 0 if $ok and $chub->count and not $chub->no_ending and not $chub->ended
263 0 0 $plan =~ /\D/ ? :
264 0 0 if ($count and $num_extra != 0)
265 0 0 $plan == 1 ? :
271 0 0 if ($failed)
272 0 0 $failed == 1 ? :
274 0 0 $num_extra == 0 ? :
281 0 0 if (not $passed || $failed and $count and not $num_extra)
289 0 0 unless ($chub->bailed_out)
291 0 0 if ($plan and $plan eq 'SKIP') { }
0 0 elsif (not $chub->count) { }
314 0 0 unless $code and &reftype($code) eq "CODE"
338 0 0 if (not $ok and $err =~ /Label not found for "last T2_SUBTEST_WRAPPER"/ or &blessed($err) and &blessed($err) eq 'Test::Builder::Exception') { }
347 0 0 if ($start_pid != $$ and not $INC{'Test2/IPC.pm'})
348 0 0 $ok ? :
354 0 0 unless ($finished)
355 0 0 if (my $bailed = $st_ctx->hub->bailed_out)
362 0 0 if $code
369 0 0 if (not $count and !defined($plan) || "$plan" ne 'SKIP')
370 0 0 unless defined $plan
378 0 0 unless $ok
380 0 0 if defined $child_error
401 0 0 $ENV{'TEST_NO_LOG_RESULTS'} ? :
0 6 unless $params{'singleton'}
403 0 6 Test2::API::test2_in_preload() ? :
408 0 6 unless ($params{'singleton'})
425 0 6 unless $params{'singleton'}
430 6 0 if ($format and $format->isa("Test2::Formatter::TAP"))
433 6 0 $out ? :
437 0 6 unless $params{'singleton'}
438 0 6 unless $params{'singleton'}
456 0 1 unless $cmd
461 0 1 if $hub->plan
465 1 0 if (my $method = $plan_cmds{$cmd}) { }
483 3 0 if ($arg) { }
0 0 elsif (not defined $arg) { }
504 3 0 if (@_)
505 0 3 unless $max =~ /^\+?\d+$/
516 0 3 unless $plan
517 0 3 if $plan =~ /\D/
527 0 0 if (defined $ctx->hub->plan)
533 0 0 if $arg
548 0 0 if ($meta->{'Done_Testing'})
561 0 0 if (defined $num_tests) { }
0 0 elsif ($count and defined $num_tests and $count != $num_tests) { }
562 0 0 if not $plan or $plan eq "NO PLAN"
571 0 0 if ($self->expected_tests and $num_tests != $self->expected_tests)
576 0 0 if $ctx->hub->plan and $ctx->hub->plan eq "NO PLAN"
591 0 0 if $plan and not $plan =~ /\D/
592 0 0 if $plan and $plan eq "NO PLAN"
605 0 3 if ($] < "5.02")
609 0 0 unless @call and $call[0]
610 0 0 unless $call[3] =~ /::BEGIN$/
615 0 0 if $begin and $ctx->hub->meta("Test::Builder", {})->{'parent'}
625 6 6 if (defined $pack)
639 12 0 $test ? :
643 12 0 if defined $name
647 0 12 if 0 + $name and $name =~ /^[\d\s]+$/
656 12 0 defined $name ? :
664 12 0 unless $self->{'no_log_results'}
674 0 12 if ($subevents)
689 0 12 unless $test
701 0 0 $is_todo ? :
704 0 0 if (defined $orig_name) { }
715 0 0 $self->in_todo ? :
721 0 8 unless ref $$thing
722 0 0 unless &blessed($$thing) or scalar $self->_try(sub {
743 0 0 unless $self->_is_dualvar($$val)
753 0 0 if ref $val
768 1 10 unless (defined $got and defined $expect)
773 0 1 unless $test
787 0 0 unless (defined $got and defined $expect)
792 0 0 unless $test
804 0 0 if (defined $$val) { }
805 0 0 if ($type eq 'eq' or $type eq 'ne') { }
853 0 0 unless (defined $got and defined $dont_expect)
858 0 0 unless $test
871 0 0 unless (defined $got and defined $dont_expect)
876 0 0 unless $test
913 0 10 if ($cmp_ok_bl{$type})
940 0 10 $numeric_cmps{$type} ? :
944 0 10 unless $succ
951 0 10 unless ($ok)
954 0 0 if ($type =~ /^(eq|==)$/) { }
0 0 elsif ($type =~ /^(ne|!=)$/) { }
966 0 0 if ($eq) { }
983 0 0 defined $got ? :
984 0 0 defined $expect ? :
1000 0 0 if defined $file and defined $line
1025 0 0 unless defined $name
1036 0 0 unless $self->{'no_log_results'}
1061 0 0 unless $self->{'no_log_results'}
1075 0 0 unless defined $regex
1080 0 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) { }
1088 0 0 length $opts ? :
1099 0 0 if defined &re::is_regexp
1108 0 0 unless (defined $usable_regex)
1130 0 0 if $cmp eq "!~"
1136 0 0 unless ($ok)
1137 0 0 defined $thing ? :
1138 0 0 $cmp eq '=~' ? :
1155 0 0 unless defined $maybe_fh
1157 0 0 if ref $maybe_fh eq "GLOB"
1158 0 0 if ref \$maybe_fh eq "GLOB"
1168 0 0 if (defined $level)
1180 0 6 unless ($format and $format->can("no_numbers") and $format->can("set_no_numbers"))
1181 0 0 if $format
1185 6 0 if defined $use_nums
1187 0 6 $format->no_numbers ? :
1198 0 0 unless ($format and $format->can($set))
1199 0 0 if $format
1204 0 0 if defined $no
1206 0 0 $format->$method ? :
1219 0 0 if defined $no
1226 0 1 unless @_
1228 1 0 defined $_ ? :
1230 0 1 if (Test2::API::test2_in_preload())
1246 0 0 unless @_
1248 0 0 defined $_ ? :
1250 0 0 if (Test2::API::test2_in_preload())
1272 0 0 ref $_ ? :
1275 0 0 if $dumper->can("Sortkeys")
1289 0 0 unless $format and $format->isa("Test2::Formatter::TAP")
1291 0 0 if defined $fh
1303 0 0 unless $format and $format->isa("Test2::Formatter::TAP")
1305 0 0 if defined $fh
1317 0 0 unless $format and $format->isa("Test::Builder::Formatter")
1319 0 0 if defined $fh
1330 0 0 if ($self->is_fh($file_or_fh)) { }
0 0 elsif (ref $file_or_fh eq 'SCALAR') { }
1335 0 0 if ($] >= 5.008) { }
1336 0 0 unless open $fh, ">>", $file_or_fh
1341 0 0 unless $fh = "Test::Builder::IO::Scalar"->new($file_or_fh)
1346 0 0 unless open $fh, ">", $file_or_fh
1370 0 6 unless $format and $format->isa("Test2::Formatter::TAP")
1371 6 0 if $self->{'Orig_Handles'}
1398 0 0 if (defined $num)
1401 0 0 unless ($self->{'no_log_results'})
1404 0 0 if ($num > @$test_results) { }
0 0 elsif ($num < @$test_results) { }
1405 0 0 @$test_results ? :
1432 0 0 if (@_)
1434 0 0 if $bool
1445 0 0 if $self->{'no_log_results'}
1450 0 0 $_ ? :
1457 0 0 if $self->{'no_log_results'}
1474 0 0 unless $pack
1479 0 0 if $set
1491 0 0 if $meta and @$meta
1495 0 0 unless $pack
1510 0 0 if $meta and @$meta
1518 0 0 unless defined $todo
1519 0 0 if "$todo" eq ""
1525 0 0 @_ ? :
1534 0 0 if ref $e eq "Test2::Event::Diag"
1537 0 0 if ($hub == $active_hub and $e->isa("Test2::Event::Ok"))
1541 0 0 if (my $result = $e->get_meta("Test::Builder"))
1565 0 0 unless $set
1582 0 0 wantarray ? :
1599 0 0 if $error and $opts{'die_on_fail'}
1601 0 0 wantarray ? :
1608 0 6 unless ($ctx)
1614 0 6 if $ctx->hub->no_ending
1615 0 6 if $ctx->hub->meta("Test::Builder", {})->{'Ending'}++
1619 0 6 unless $self->{'Original_Pid'} == $$
1622 0 6 if $hub->bailed_out
1628 0 0 unless $plan or $count or $failed
1631 0 6 if (not $hub->plan and $hub->count)
1634 0 0 if ($real_exit_code)
1643 0 0 if ($failed > 0)
1644 0 0 $failed <= 254 ? :
1653 0 6 if ($real_exit_code and not $count)
1659 3 3 if $plan and "$plan" eq "SKIP"
1661 0 3 unless ($count)
1667 0 3 if ($real_exit_code)
1675 0 3 if ($plan eq "NO PLAN")
1683 0 3 if ($num_extra != 0)
1684 0 0 $plan == 1 ? :
1690 0 3 if ($failed)
1691 0 0 $failed == 1 ? :
1693 0 0 $num_extra == 0 ? :
1700 0 0 if (not $passed || $failed and $count and not $num_extra)
1707 0 3 if ($failed) { }
0 3 elsif ($num_extra != 0) { }
0 3 elsif (not $passed) { }
1708 0 0 $failed <= 254 ? :
1726 0 0 if $self->no_diag
1727 0 0 unless @msgs
1730 0 0 if $^C
1734 0 0 defined $_ ? :