Branch Coverage

inc/Test/Builder.pm
Criterion Covered Total %
branch 106 392 27.0


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 111 0 $e->{'trace'} ? :
63 111 0 if $cpkg
64 96 15 if $epkg and not $todo
66 111 0 unless $todo
69 0 0 if ref $e eq 'Test2::Event::Diag'
72 0 0 if ($e->isa('Test2::Event::Ok'))
76 0 0 if (my $result = $e->get_meta('Test::Builder'))
89 6 83 unless ($Test)
111 6 0 if ($params{'singleton'}) { }
149 0 9 unless $parent
167 0 9 if $pmeta->{'child'}
184 0 0 if ref $e eq 'Test2::Event::Diag'
187 0 9 if $orig_TODO
191 0 9 $parent->isa('Test2::Hub::Subtest') ? :
201 9 0 $parent->format ? :
212 9 0 if @_
218 0 9 if ($meta->{'child'})
233 0 9 if $ok and $chub->count and not $chub->no_ending and not $chub->ended
244 0 9 $plan =~ /\D/ ? :
245 0 9 if ($count and $num_extra != 0)
246 0 0 $plan == 1 ? :
252 0 9 if ($failed)
253 0 0 $failed == 1 ? :
255 0 0 $num_extra == 0 ? :
262 0 0 if (not $passed || $failed and $count and not $num_extra)
270 9 0 unless ($chub->bailed_out)
272 0 9 if ($plan and $plan eq 'SKIP') { }
0 9 elsif (not $chub->count) { }
294 0 9 unless $code and &reftype($code) eq 'CODE'
314 0 9 if (not $ok and $err =~ /Label not found for "last T2_SUBTEST_WRAPPER"/ or &blessed($err) and &blessed($err) eq 'Test::Builder::Exception') { }
323 0 9 if ($start_pid != $$ and not $INC{'Test/Sync/IPC.pm'})
324 0 0 $ok ? :
330 0 9 unless ($finished)
331 0 0 if (my $bailed = $st_ctx->hub->bailed_out)
338 0 0 if $code
345 0 0 if (not $count and !defined($plan) || "$plan" ne 'SKIP')
346 0 0 unless defined $plan
354 0 9 unless $ok
356 9 0 if defined $child_error
379 0 6 unless ($params{'singleton'})
400 6 0 if ($format and $format->isa('Test2::Formatter::TAP'))
403 6 0 $out ? :
426 5 1 unless $cmd
431 0 1 if $hub->plan
435 1 0 if (my $method = $plan_cmds{$cmd}) { }
453 0 0 if ($arg) { }
0 0 elsif (not defined $arg) { }
474 0 14 if (@_)
475 0 0 unless $max =~ /^\+?\d+$/
486 14 0 unless $plan
487 0 0 if $plan =~ /\D/
497 0 1 if (defined $ctx->hub->plan)
503 0 1 if $arg
518 0 14 if ($meta->{'Done_Testing'})
531 0 14 if (defined $num_tests) { }
0 14 elsif ($count and defined $num_tests and $count != $num_tests) { }
532 0 0 if not $plan or $plan eq 'NO PLAN'
541 0 14 if ($self->expected_tests and $num_tests != $self->expected_tests)
546 0 14 if $ctx->hub->plan and $ctx->hub->plan eq 'NO PLAN'
561 0 0 if $plan and not $plan =~ /\D/
562 0 0 if $plan and $plan eq 'NO PLAN'
575 0 0 if ($] < 5.02)
579 0 0 unless @call and $call[0]
580 0 0 unless $call[3] =~ /::BEGIN$/
585 0 0 if $begin and $ctx->hub->meta('Test::Builder', {})->{'parent'}
595 5 5 if (defined $pack)
609 53 0 $test ? :
613 51 2 if defined $name
617 0 53 if 0 + $name and $name =~ /^[\d\s]+$/
626 51 2 defined $name ? :
643 9 44 if ($subevents)
658 0 53 unless $test
670 0 0 $is_todo ? :
673 0 0 if $ENV{'HARNESS_ACTIVE'} and $dfh
676 0 0 if (defined $orig_name) { }
688 0 0 $self->in_todo ? :
694 0 20 unless ref $$thing
695 20 0 unless &blessed($$thing) or scalar $self->_try(sub { $$thing->isa('UNIVERSAL'); } )
716 0 0 unless $self->_is_dualvar($$val)
726 0 0 if ref $val
741 2 10 unless (defined $got and defined $expect)
746 0 2 unless $test
760 0 0 unless (defined $got and defined $expect)
765 0 0 unless $test
777 0 0 if (defined $$val) { }
778 0 0 if ($type eq 'eq' or $type eq 'ne') { }
826 0 1 unless (defined $got and defined $dont_expect)
831 0 0 unless $test
844 0 0 unless (defined $got and defined $dont_expect)
849 0 0 unless $test
886 0 11 if ($cmp_ok_bl{$type})
913 0 11 $numeric_cmps{$type} ? :
917 0 11 unless $succ
924 0 11 unless ($ok)
927 0 0 if ($type =~ /^(eq|==)$/) { }
0 0 elsif ($type =~ /^(ne|!=)$/) { }
939 0 0 if ($eq) { }
956 0 0 defined $got ? :
957 0 0 defined $expect ? :
973 1 0 if defined $file and defined $line
998 0 0 unless defined $name
1048 0 1 unless defined $regex
1053 1 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) { }
1061 0 0 length $opts ? :
1072 1 0 if defined &re::is_regexp
1081 0 1 unless (defined $usable_regex)
1103 0 1 if $cmp eq '!~'
1109 0 1 unless ($ok)
1110 0 0 defined $thing ? :
1111 0 0 $cmp eq '=~' ? :
1128 0 0 unless defined $maybe_fh
1130 0 0 if ref $maybe_fh eq 'GLOB'
1131 0 0 if ref \$maybe_fh eq 'GLOB'
1141 0 0 if (defined $level)
1153 0 6 unless ($format and $format->can('no_numbers') and $format->can('set_no_numbers'))
1154 0 0 if $format
1158 6 0 if defined $use_nums
1160 0 6 $format->no_numbers ? :
1171 0 6 unless ($format and $format->can($set))
1172 0 0 if $format
1177 6 0 if defined $no
1179 0 6 $format->$method ? :
1192 6 0 if defined $no
1199 0 0 unless @_
1202 0 0 defined $_ ? :
1210 0 0 unless @_
1213 0 0 defined $_ ? :
1227 0 0 ref $_ ? :
1230 0 0 if $dumper->can('Sortkeys')
1244 0 0 unless $format and $format->isa('Test2::Formatter::TAP')
1246 0 0 if defined $fh
1258 0 0 unless $format and $format->isa('Test2::Formatter::TAP')
1260 0 0 if defined $fh
1272 0 0 unless $format and $format->isa('Test::Builder::Formatter')
1274 0 0 if defined $fh
1285 0 0 if ($self->is_fh($file_or_fh)) { }
0 0 elsif (ref $file_or_fh eq 'SCALAR') { }
1290 0 0 if ($] >= 5.008) { }
1291 0 0 unless open $fh, '>>', $file_or_fh
1296 0 0 unless $fh = 'Test::Builder::IO::Scalar'->new($file_or_fh)
1301 0 0 unless open $fh, '>', $file_or_fh
1325 0 6 unless $format and $format->isa('Test2::Formatter::TAP')
1326 6 0 if $self->{'Orig_Handles'}
1353 0 14 if (defined $num)
1358 0 0 if ($num > @$test_results) { }
0 0 elsif ($num < @$test_results) { }
1359 0 0 @$test_results ? :
1385 0 0 if (@_)
1387 0 0 if $bool
1422 0 18 unless $pack
1427 18 0 if $set
1439 0 0 if $meta and @$meta
1443 0 0 unless $pack
1458 0 0 if $meta and @$meta
1466 0 0 unless defined $todo
1467 0 0 if "$todo" eq ''
1473 0 0 @_ ? :
1482 0 0 if ref $e eq 'Test2::Event::Diag'
1485 0 0 if ($hub == $active_hub and $e->isa('Test2::Event::Ok'))
1489 0 0 if (my $result = $e->get_meta('Test::Builder'))
1513 0 0 unless $set
1530 1 0 wantarray ? :
1547 0 20 if $error and $opts{'die_on_fail'}
1549 3 20 wantarray ? :
1556 0 6 unless ($ctx)
1562 0 6 if $ctx->hub->no_ending
1563 0 6 if $ctx->hub->meta('Test::Builder', {})->{'Ending'}++
1567 0 6 unless $self->{'Original_Pid'} == $$
1570 0 6 if $hub->bailed_out
1576 0 0 unless $plan or $count or $failed
1579 0 6 if (not $hub->plan and $hub->count)
1582 0 0 if ($real_exit_code)
1591 0 0 if ($failed > 0)
1592 0 0 $failed <= 254 ? :
1601 0 6 if ($real_exit_code and not $count)
1607 0 6 if $plan and "$plan" eq 'SKIP'
1609 0 6 unless ($count)
1615 0 6 if ($real_exit_code)
1623 0 6 if ($plan eq 'NO PLAN')
1631 0 6 if ($num_extra != 0)
1632 0 0 $plan == 1 ? :
1638 0 6 if ($failed)
1639 0 0 $failed == 1 ? :
1641 0 0 $num_extra == 0 ? :
1648 0 0 if (not $passed || $failed and $count and not $num_extra)
1655 0 6 if ($failed) { }
0 6 elsif ($num_extra != 0) { }
0 6 elsif (not $passed) { }
1656 0 0 $failed <= 254 ? :
1674 0 0 if $self->no_diag
1675 0 0 unless @msgs
1678 0 0 if $^C
1682 0 0 defined $_ ? :