Branch Coverage

blib/lib/Docopt.pm
Criterion Covered Total %
branch 203 238 85.2


line true false branch
30 0 801 unless ($self->can('children'))
36 445 581 if (not $child->can('children')) { }
38 0 445 unless in(serialize $child, [map({serialize $_;} @$uniq)])
69 717 488 if serialize $stuff eq serialize $_
78 112 55 if ($e->isa('Docopt::Argument') or $e->isa('Docopt::Option') and $e->argcount)
79 83 29 if (not defined $e->value) { }
12 17 elsif (ref $e->value ne 'ARRAY') { }
85 67 100 if ($e->isa('Docopt::Command') or $e->isa('Docopt::Option') and $e->argcount == 0)
128 837 302 if (any sub {
132 60 777 if ($child->isa('Docopt::Either')) { }
41 736 elsif ($child->isa('Docopt::OneOrMore')) { }
186 801 108 if @_ == 0
187 108 0 if (@_ == 1) { }
213 2097 550 if (not defined $types or $self->isa($types)) { }
222 12 531 unless shift()
225 212 331 unless ($match)
230 118 213 if (is_number($self->value) or ref $self->value eq 'ARRAY')
232 60 58 if (is_number($self->value)) { }
235 1 57 ref $match->value eq 'ARRAY' ? :
237 64 54 unless (@same_name)
242 23 31 if (ref $same_name[0]->value eq 'ARRAY') { }
243 23 0 ref $increment eq 'ARRAY' ? :
245 0 31 unless ref $increment ne 'ARRAY'
264 0 1554 unless @_ == 2
265 0 1554 unless ref $children eq 'ARRAY'
268 0 2109 ref $_ eq 'ARRAY' ? :
277 9800 43 if @_ == 0
278 43 0 if (@_ == 1) { }
279 0 43 unless ref $_[0] eq 'ARRAY'
296 44 4135 if (defined $types and $self->isa($types))
299 5420 0 ref $_ eq 'ARRAY' ? :
311 0 167 unless ref $left eq 'ARRAY'
315 108 19 if ($pattern->isa('Docopt::Argument'))
349 0 48 unless ref $left eq 'ARRAY'
353 39 3 if ($pattern->isa('Docopt::Argument'))
354 30 9 if ($pattern->value eq $self->name) { }
378 75 520 unless ($matched)
379 0 75 unless ref $c eq 'ARRAY'
383 0 437 unless ref $c eq 'ARRAY'
407 0 234 unless ref $collected eq 'ARRAY'
413 0 234 unless ref $collected eq 'ARRAY'
437 0 45 unless @{$self->children;} == 1
449 81 34 if $matched
450 36 79 if (serialize(\$l_) eq serialize(\$l))
455 36 9 if ($times >= 1)
492 62 62 if ($matched)
496 46 9 if (@outcomes)
499 10 6 if (@{$$_[1];} < @{$$retval[1];})
530 49 431 unless (ref $source)
540 2008 1557 if defined $_
576 203 765 if (@_ <= 3)
578 139 829 !defined($value) && $argcount ? :
588 1220 320 if @_ == 0
589 320 0 if (@_ == 1) { }
600 0 328 unless ref $left eq 'ARRAY'
604 193 115 if ($self->name eq defined_or($pattern->name, ''))
613 401 854 if (defined $self->long and not ref $self->long) { }
629 99 248 if ($s =~ /^--/) { }
179 69 elsif ($s =~ /^-/) { }
637 65 192 if ($argcount)
638 19 46 if (defined $description and $description =~ /\[default: (.*)\]/i)
661 0 147 unless ref $options eq 'ARRAY'
664 0 147 unless $long =~ /\A--/
665 115 32 $eq eq '' && $value eq '' ? :
666 175 34 if $_->long
667 18 129 if ($tokens->error eq 'Docopt::Exceptions::DocoptExit' and @similar == 0)
668 16 10 if $_->long
671 3 144 if (@similar > 1) { }
48 96 elsif (@similar < 1) { }
675 15 33 $eq eq '=' ? :
678 10 38 if ($tokens->error eq 'Docopt::Exceptions::DocoptExit')
679 2 8 $argcount ? :
688 62 34 if ($o->argcount == 0) { }
689 3 59 if (defined $value)
693 20 14 unless (defined $value)
694 3 17 if (not defined $tokens->current or $tokens->current eq '--')
701 57 33 if ($tokens->error eq 'Docopt::Exceptions::DocoptExit')
702 24 33 defined $value ? :
750 1 306 if (@similar > 1) { }
45 261 elsif (@similar < 1) { }
756 5 40 if ($tokens->error eq 'Docopt::Exceptions::DocoptExit')
764 28 233 if ($o->argcount != 0)
765 20 8 if ($left eq '') { }
766 2 18 if (not defined $tokens->current or $tokens->current eq '--')
775 127 132 if ($tokens->error eq 'Docopt::Exceptions::DocoptExit')
776 14 113 defined $value ? :
822 1 239 if (defined $tokens->current)
842 662 59 if (not defined $tokens->current or $tokens->current ne '|')
847 4 55 @$seq > 1 ? :
851 19 54 @$seq > 1 ? :
854 0 132 ref $_ eq 'ARRAY' ? :
59 0 @result > 1 ? :
873 39 883 if (defined $tokens->current and $tokens->current eq '...')
879 883 39 ref $_ eq 'ARRAY' ? :
899 484 446 if ($token eq '(' or $token eq '[') { }
49 397 elsif ($token eq 'options') { }
72 325 elsif ($token =~ /^--/ and $token ne '--') { }
135 190 elsif ($token =~ /^-/ and ($token ne '-' and $token ne '--')) { }
142 48 elsif ($token =~ /^</ and $token =~ />$/ or $token =~ /\A[A-Z]+\z/) { }
907 3 478 if (($tokens->move || '') ne $matching)
954 0 232 unless ref $options eq 'ARRAY'
958 3 277 if ($tokens->current eq '--') { }
75 202 elsif ($tokens->current =~ /\A--/) { }
100 102 elsif ($tokens->current =~ /\A-/ and $tokens->current ne '-') { }
1 101 elsif ($options_first) { }
997 0 514 unless defined $source
1014 25 491 $_ eq $cmd ? :
1021 2 291 if in($_->name, ['-h', '--help'])
2 213 if ($help and any sub {
1025 0 0 if defined $_->name
0 213 if ($version and grep {$_->name eq '--version' if defined $_->name;} @$options)
1041 0 233 unless @_ % 2 == 0
1047 0 233 exists $args{'help'} ? :
1051 0 233 if (%args)
1055 0 233 unless (defined $doc)
1060 0 0 unless open my $fh, '>', \$doc
1071 1 232 if (@usage_sections == 0)
1074 1 231 if (@usage_sections > 1)
1104 173 40 if ($matched and serialize $left eq serialize([]))