Condition Coverage

blib/lib/OptArgs2.pm
Criterion Covered Total %
condition 47 133 35.3


and 3 conditions

line !l l&&!r l&&r condition
135 7 3 1 not @_ and @ARGV
277 2 4 0 $self->required and defined $self->default
579 13 0 0 defined $result and my $t = $try->trigger
602 3 1 7 @$source and my(@subcmds) = @{$cmd->subcmds;}
630 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')
705 1 1 2 $try->isa eq "SubCmd" and not $try->fallthru
787 0 0 0 $overlap > 0 and not $paged
808 4 4 0 @parents and $style ne "HelpSummary"
839 4 0 0 $style eq "Help" and length $self->comment
898 0 4 0 $style ne "Help" and $opt->hidden

or 2 conditions

line l !l condition
363 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])); } ; }
398 4 0 $self->alias // ""
596 0 0 $reason //= ["OptRequired", qq[missing required option "--$name"]]
647 0 0 $reason //= ["OptUnknown", qq[unknown option "$o"]]
705 0 2 $reason //= ["SubCmdUnknown", "unknown ${name}: " . ("ARRAY" eq ref $result ? $result->[0] : ("HASH" eq ref $result ? join(",", map({"$_=$result->{$_}";} keys %$result)) : $result))]
722 0 2 $reason //= ["ArgRequired"]
728 0 0 $reason //= ["UnexpectedOptArg", "unexpected option(s) or argument(s): @$source"]
734 0 0 $reason //= ["UnexpectedHashOptArg", "unexpected HASH option(s) or argument(s): @unexpected"]
753 0 0 shift() || 0
765 8 0 shift() || 'Usage'
766 2 6 shift() // ""
854 0 0 $$optargs{$arg->name} // undef
884 0 0 $$optargs{$arg->name} // undef
901 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() || 'OptArgs2'->throw_error('Usage', 'usage($CLASS,[$style])')
292 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)
339 0 6 0 $ref->{'name'} //= lc $name
340 0 6 0 $ref->{'alias'} //= lc substr($ref->{'name'}, 0, 1)
341 0 6 0 $ref->{'comment'} //= "print a $style message and exit"
421 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)
567 11 0 11 @opts or @args
583 0 1 12 $result //= $try->default
608 2 0 0 $abbrev{$result} // $result
630 0 0 4 $source->[0] =~ /^--\S/ or $source->[0] =~ /^-\S/ and not $source->[0] =~ /^-\d/ && ($try->isa ne 'Num' || $try->isa ne 'Int')
662 0 0 0 $try->isa eq "ArrayRef" or $try->isa eq "SubCmd"
697 4 0 3 $result //= $try->default