Condition Coverage

blib/lib/OptArgs2.pm
Criterion Covered Total %
condition 48 144 33.3


and 3 conditions

line !l l&&!r l&&r condition
135 7 3 1 not @_ and @ARGV
301 2 4 0 $self->required and defined $self->default
616 13 0 0 defined $result and my $t = $try->trigger
639 3 1 7 @$source and my(@subcmds) = @{$cmd->subcmds;}
665 0 0 0 $source->[0] =~ /^-\d/ && ($try->isa ne 'Num' || $try->isa ne 'Int')
4 0 0 $source->[0] =~ /^-\S/ and not $source->[0] =~ /^-\d/ && ($try->isa ne 'Num' || $try->isa ne 'Int')
740 1 1 2 $try->isa eq "SubCmd" and not $try->fallthru
822 0 0 0 $overlap > 0 and not $paged
843 4 4 0 @parents and $style ne "HelpSummary"
874 4 0 0 $style eq "Help" and length $self->comment
933 0 4 0 $style ne "Help" and $opt->hidden

or 2 conditions

line l !l condition
361 0 0 $ref->{'isa'} //= "Help"
393 0 6 $ref->{'trigger'} //= sub { my $cmd = shift(); my $val = shift(); if ($val == 1) { "OptArgs2"->throw_usage("Help", $cmd->usage_string("Help")); } elsif ($val == 2) { "OptArgs2"->throw_usage("HelpTree", $cmd->usage_string("HelpTree")); } else { "OptArgs2"->throw_usage("UnexpectedOptArg", $cmd->usage_string("Usage", qq["--$ref->{'name'}" used too many times])); } ; }
428 4 0 $self->alias // ""
633 0 0 $reason //= ["OptRequired", qq[missing required option "--$name"]]
682 0 0 $reason //= ["OptUnknown", qq[unknown option "$o"]]
740 0 2 $reason //= ["SubCmdUnknown", "unknown ${name}: " . ("ARRAY" eq ref $result ? $result->[0] : ("HASH" eq ref $result ? join(",", map({"$_=$result->{$_}";} keys %$result)) : $result))]
757 0 2 $reason //= ["ArgRequired"]
763 0 0 $reason //= ["UnexpectedOptArg", "unexpected option(s) or argument(s): @$source"]
769 0 0 $reason //= ["UnexpectedHashOptArg", "unexpected HASH option(s) or argument(s): @unexpected"]
788 0 0 shift() || 0
800 8 0 shift() || 'Usage'
801 2 6 shift() // ""
889 0 0 $$optargs{$arg->name} // undef
919 0 0 $$optargs{$arg->name} // undef
936 0 0 $$optargs{$opt->name} // undef

or 3 conditions

line l !l&&r !l&&!r condition
46 0 0 0 $chars[0] // _chars()->[0]
50 0 0 0 $chars[1] // _chars()->[1]
68 1 0 0 shift() // Carp::croak("Usage", "error(\$TYPE, [\$msg])")
70 1 0 0 shift() // "($pkg)"
98 4 0 0 shift() // $proto->error("Usage", "usage(\$TYPE, \$str)")
99 4 0 0 shift() // $proto->error("Usage", "usage(\$type, \$STR)")
126 11 0 0 shift() || 'OptArgs2'->throw_error('Usage', 'class_optargs($CMD,[@argv])')
129 11 0 0 $COMMAND{$class} || 'OptArgs2'->throw_error('CmdNotFound', 'command class not found: ' . $class)
151 6 0 0 shift() || 'OptArgs2'->throw_error('Usage', 'cmd($CLASS,@args)')
166 6 0 0 shift() || 'OptArgs2'->throw_error('Usage', 'subcmd($CLASS,%%args)')
190 0 0 0 shift() || do { my($pkg) = caller; $pkg }
207 0 0 0 $OptArgs2::CURRENT //= cmd(scalar caller, "comment", "")
217 0 0 0 $OptArgs2::CURRENT //= cmd(scalar caller, "comment", "")
316 0 4 0 $self->isa_name // $OptArgs2::OptArgBase::isa2name{$self->isa}
4 0 0 ($self->isa_name // $OptArgs2::OptArgBase::isa2name{$self->isa}) // "OptArgs2"->throw_error("InvalidIsa", "invalid isa type: " . $self->isa)
369 0 6 0 $ref->{'name'} //= lc $name
370 0 6 0 $ref->{'alias'} //= lc substr($ref->{'name'}, 0, 1)
371 0 6 0 $ref->{'comment'} //= "print a $style message and exit"
451 0 0 4 $self->isa_name // $OptArgs2::OptArgBase::isa2name{$self->isa}
4 0 0 ($self->isa_name // $OptArgs2::OptArgBase::isa2name{$self->isa}) // "OptArgs2"->throw_error("InvalidIsa", "invalid isa type: " . $self->isa)
604 11 0 11 @opts or @args
620 0 1 12 $result //= $try->default
645 2 0 0 $abbrev{$result} // $result
665 0 0 4 $source->[0] =~ /^--\S/ or $source->[0] =~ /^-\S/ and not $source->[0] =~ /^-\d/ && ($try->isa ne 'Num' || $try->isa ne 'Int')
697 0 0 0 $try->isa eq "ArrayRef" or $try->isa eq "SubCmd"
732 4 0 3 $result //= $try->default
1012 0 0 6 $self->no_help or "CODE" eq ref $self->optargs