Branch Coverage

blib/lib/OptArgs2/CmdBase.pm
Criterion Covered Total %
branch 104 168 61.9


line true false branch
23 6 0 @_CLASS > 1 ? :
24 6 0 if exists $OptArgs2::CmdBase::_FIELDS->{'FIELDS'}
26 1 15 if (my(@missing) = grep({not exists $_[0]{$_};} "class", "comment"))
31 5 10 if exists $_[0]{'parent'} and ref $_[0]{'parent'}
43 0 21 if @_ > 1
48 14 9 if (@_ > 1)
53 0 12 if (@_ > 1)
58 0 38 if @_ > 1
61 0 28 if @_ > 1
62 0 4 if @_ > 1
63 0 4 if @_ > 1
66 0 51 if (@_ > 1)
71 0 45 if @_ > 1
74 0 23 if @_ > 1
77 0 9 if @_ > 1
82 0 26 if @_ > 1
87 0 11 if @_ > 1
120 0 15 if ("CODE" eq ref $self->optargs)
128 6 7 if ($args->{'isa'} =~ s/^--//) { }
129 2 4 if (length(my $alias = ($args->{'alias'} //= undef)))
132 1 1 if $aliases{$alias}++
170 0 5 unless exists $usage_why{$why}
201 0 5 if exists $self->_subcmds->{$subcmd->name}
222 23 4 unless $self->parent
231 0 2 unless 3 == @_
250 0 13 if not defined $_
274 0 18 if (exists $source_hash->{$name}) { }
284 1 17 unless ($ok)
285 1 0 @errors ? :
0 1 length $@ ? :
294 0 18 if (defined $result and my $t = $opt->trigger)
298 2 16 if (defined($result //= $opt->default)) { }
0 16 elsif ($opt->required) { }
300 0 2 if ('CODE' eq ref $result) { }
1 1 elsif ($opt->isa eq 'Input') { }
315 0 1 unless open my $fh, "<", $result
321 0 1 $result eq '-' ? :
338 9 3 if (@$source) { }
0 3 elsif (exists $source_hash->{$name}) { }
343 0 9 if ($source->[0] =~ /^--\S/ or $source->[0] =~ /^-\S/ and not $source->[0] =~ /^-\d/ && ($arg->isa ne 'Num' || $arg->isa ne 'Int'))
388 7 2 if ($isa eq 'SubCmd') { }
0 2 elsif ($isa eq 'ArrayRef') { }
0 2 elsif ($isa eq 'HashRef') { }
391 2 5 if ($cmd->abbrev and my(@subcmds) = @{$cmd->subcmds;})
400 4 3 if (exists $cmd->_subcmds->{$test})
407 0 4 if (@{$cmd->args;} and $cmd->args->[0]->isa ne "SubCmd")
421 0 3 if $arg->name eq "__internal"
424 1 2 if ($arg->fallthru) { }
433 0 0 $arg->greedy ? :
437 0 0 $arg->greedy ? :
442 0 2 $arg->greedy ? :
445 0 5 if $arg->greedy
454 5 3 if (defined($result //= $arg->default)) { }
2 1 elsif ($arg->required) { }
455 0 5 if ('CODE' eq ref $result) { }
1 4 elsif ($isa eq 'Input') { }
470 0 1 unless open my $fh, "<", $result
476 0 1 $result eq '-' ? :
487 0 14 if (@$source) { }
0 14 elsif (my(@unexpected) = keys %$source_hash) { }
503 5 9 if $reason
527 0 9 if ($style eq &OptArgs2::USAGE_HELPTREE())
545 0 0 if ($overlap > 0 and not $paged)
566 0 9 if @parents and $style ne &OptArgs2::USAGE_HELPSUMMARY()
571 0 9 if ($self->show_color)
580 3 6 if length $error
585 1 3 unless $arg->required
587 0 4 if $arg->greedy
588 1 3 unless $arg->required
591 4 5 if $style eq &OptArgs2::USAGE_HELPSUMMARY()
593 5 0 if @opts
597 0 5 if $style eq &OptArgs2::USAGE_HELP() and length $self->comment
606 4 1 if (@args)
609 4 0 if ($arg->isa eq 'SubCmd') { }
612 0 4 $arg->show_default ? :
620 4 0 unless $style eq &OptArgs2::USAGE_HELP()
640 0 0 unless $i
643 0 0 $arg->show_default ? :
654 5 0 if (@opts)
657 0 6 if $style ne &OptArgs2::USAGE_HELP() and $opt->hidden
660 0 6 $opt->show_default ? :
678 4 1 if (@sargs)
686 0 5 if (@uargs)
695 5 0 if (@uopts)