Branch Coverage

inc/Test/Builder.pm
Criterion Covered Total %
branch 55 392 14.0


line true false branch
10 0 1 if ($] < 5.008)
21 0 1 if Test2::API::test2_init_done() or Test2::API::test2_load_done()
58 124 0 $e->{'trace'} ? :
63 124 0 if $cpkg
64 124 0 if $epkg and not $todo
66 124 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 1 125 unless ($Test)
111 1 0 if ($params{'singleton'}) { }
149 0 0 unless $parent
167 0 0 if $pmeta->{'child'}
184 0 0 if ref $e eq 'Test2::Event::Diag'
187 0 0 if $orig_TODO
191 0 0 $parent->isa('Test2::Hub::Subtest') ? :
201 0 0 $parent->format ? :
212 0 0 if @_
218 0 0 if ($meta->{'child'})
233 0 0 if $ok and $chub->count and not $chub->no_ending and not $chub->ended
244 0 0 $plan =~ /\D/ ? :
245 0 0 if ($count and $num_extra != 0)
246 0 0 $plan == 1 ? :
252 0 0 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 0 0 unless ($chub->bailed_out)
272 0 0 if ($plan and $plan eq 'SKIP') { }
0 0 elsif (not $chub->count) { }
294 0 0 unless $code and &reftype($code) eq 'CODE'
314 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') { }
323 0 0 if ($start_pid != $$ and not $INC{'Test/Sync/IPC.pm'})
324 0 0 $ok ? :
330 0 0 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 0 unless $ok
356 0 0 if defined $child_error
379 0 1 unless ($params{'singleton'})
400 1 0 if ($format and $format->isa('Test2::Formatter::TAP'))
403 1 0 $out ? :
426 0 1 unless $cmd
431 0 1 if $hub->plan
435 1 0 if (my $method = $plan_cmds{$cmd}) { }
453 1 0 if ($arg) { }
0 0 elsif (not defined $arg) { }
474 1 0 if (@_)
475 0 1 unless $max =~ /^\+?\d+$/
486 0 1 unless $plan
487 0 1 if $plan =~ /\D/
497 0 0 if (defined $ctx->hub->plan)
503 0 0 if $arg
518 0 0 if ($meta->{'Done_Testing'})
531 0 0 if (defined $num_tests) { }
0 0 elsif ($count and defined $num_tests and $count != $num_tests) { }
532 0 0 if not $plan or $plan eq 'NO PLAN'
541 0 0 if ($self->expected_tests and $num_tests != $self->expected_tests)
546 0 0 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 1 1 if (defined $pack)
609 123 0 $test ? :
613 1 122 if defined $name
617 0 123 if 0 + $name and $name =~ /^[\d\s]+$/
626 1 122 defined $name ? :
643 0 123 if ($subevents)
658 0 123 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 0 unless ref $$thing
695 0 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 0 0 unless (defined $got and defined $expect)
746 0 0 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 0 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 0 if ($cmp_ok_bl{$type})
913 0 0 $numeric_cmps{$type} ? :
917 0 0 unless $succ
924 0 0 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 0 0 if defined $file and defined $line
998 0 0 unless defined $name
1048 0 0 unless defined $regex
1053 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) { }
1061 0 0 length $opts ? :
1072 0 0 if defined &re::is_regexp
1081 0 0 unless (defined $usable_regex)
1103 0 0 if $cmp eq '!~'
1109 0 0 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 1 unless ($format and $format->can('no_numbers') and $format->can('set_no_numbers'))
1154 0 0 if $format
1158 1 0 if defined $use_nums
1160 0 1 $format->no_numbers ? :
1171 0 1 unless ($format and $format->can($set))
1172 0 0 if $format
1177 1 0 if defined $no
1179 0 1 $format->$method ? :
1192 1 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 1 unless $format and $format->isa('Test2::Formatter::TAP')
1326 1 0 if $self->{'Orig_Handles'}
1353 0 0 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 0 unless $pack
1427 0 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 0 0 wantarray ? :
1547 0 0 if $error and $opts{'die_on_fail'}
1549 0 0 wantarray ? :
1556 0 1 unless ($ctx)
1562 0 1 if $ctx->hub->no_ending
1563 0 1 if $ctx->hub->meta('Test::Builder', {})->{'Ending'}++
1567 0 1 unless $self->{'Original_Pid'} == $$
1570 0 1 if $hub->bailed_out
1576 0 0 unless $plan or $count or $failed
1579 0 1 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 1 if ($real_exit_code and not $count)
1607 0 1 if $plan and "$plan" eq 'SKIP'
1609 0 1 unless ($count)
1615 0 1 if ($real_exit_code)
1623 0 1 if ($plan eq 'NO PLAN')
1631 0 1 if ($num_extra != 0)
1632 0 0 $plan == 1 ? :
1638 0 1 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 1 if ($failed) { }
0 1 elsif ($num_extra != 0) { }
0 1 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 $_ ? :