Condition Coverage

blib/lib/OptArgs2.pm
Criterion Covered Total %
condition 47 135 34.8


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
585 13 0 0 defined $result and my $t = $try->trigger
608 3 1 7 @$source and my(@subcmds) = @{$cmd->subcmds;}
636 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')
711 1 1 2 $try->isa eq "SubCmd" and not $try->fallthru
793 0 0 0 $overlap > 0 and not $paged
814 4 4 0 @parents and $style ne "HelpSummary"
845 4 0 0 $style eq "Help" and length $self->comment
904 0 4 0 $style ne "Help" and $opt->hidden

or 2 conditions

line l !l condition
338 0 0 $ref->{'isa'} //= "Help"
370 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])); } ; }
405 4 0 $self->alias // ""
602 0 0 $reason //= ["OptRequired", qq[missing required option "--$name"]]
653 0 0 $reason //= ["OptUnknown", qq[unknown option "$o"]]
711 0 2 $reason //= ["SubCmdUnknown", "unknown ${name}: " . ("ARRAY" eq ref $result ? $result->[0] : ("HASH" eq ref $result ? join(",", map({"$_=$result->{$_}";} keys %$result)) : $result))]
728 0 2 $reason //= ["ArgRequired"]
734 0 0 $reason //= ["UnexpectedOptArg", "unexpected option(s) or argument(s): @$source"]
740 0 0 $reason //= ["UnexpectedHashOptArg", "unexpected HASH option(s) or argument(s): @unexpected"]
759 0 0 shift() || 0
771 8 0 shift() || 'Usage'
772 2 6 shift() // ""
860 0 0 $$optargs{$arg->name} // undef
890 0 0 $$optargs{$arg->name} // undef
907 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)
346 0 6 0 $ref->{'name'} //= lc $name
347 0 6 0 $ref->{'alias'} //= lc substr($ref->{'name'}, 0, 1)
348 0 6 0 $ref->{'comment'} //= "print a $style message and exit"
428 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)
573 11 0 11 @opts or @args
589 0 1 12 $result //= $try->default
614 2 0 0 $abbrev{$result} // $result
636 0 0 4 $source->[0] =~ /^--\S/ or $source->[0] =~ /^-\S/ and not $source->[0] =~ /^-\d/ && ($try->isa ne 'Num' || $try->isa ne 'Int')
668 0 0 0 $try->isa eq "ArrayRef" or $try->isa eq "SubCmd"
703 4 0 3 $result //= $try->default