Branch Coverage

blib/lib/YAML/Parser.pm
Criterion Covered Total %
branch 153 292 52.4


line true false branch
19 1 1 unless (defined $self->{'receiver'})
130 68 6490 if not ref $_[0]
139 0 6478 if isNull($value)
140 6460 18 if isBoolean($value)
141 12 6 if isNumber($value)
142 6 0 if isString($value)
143 0 0 if isFunction($value)
144 0 0 if isArray($value)
145 0 0 if isObject($value)
155 0 2752 if $@
163 80 2902 if ($o eq "\x{feff}")
166 104 2798 if (isFunction($o))
169 72 2726 if (isObject($o))
172 46 2680 if (isArray($o))
175 2630 50 if (isString($o))
192 0 3658 unless my $func = $self->can($name)
234 0 0 if (@_) { }
3400 0 2 unless my $m = $self->call([$self->func("auto_detect_indent"), $n], "number")
3488 0 2 unless my $m = $self->call([$self->func("auto_detect_indent"), $n], "number")
4032 0 2 unless length $input == 0 or $input =~ /\n\z/u
4036 2 0 unless &Encode::is_utf8($input)
4049 0 2 if ($@)
4054 0 2 unless $ok
4056 0 2 if $self->{'pos'} < $self->{'end'}
4063 4 16518 unless $self->{'state'}[-1]
4099 0 6484 unless defined $curr
4109 516 5970 if isArray($func)
4111 2 6484 if isNumber($func) or isString($func)
4113 0 6484 unless isFunction($func)
4123 2 6482 if ($func->{'name'} eq "l_bare_document")
4129 44 726 isFunction($_) ? :
4 770 isArray($_) ? :
4141 0 6484 if $type ne "any" and typeof($value) ne $type
4145 24 6460 if ($type ne 'boolean') { }
4149 1906 4554 if ($value) { }
4168 12758 186 unless $receiver
4183 788 4976 if ($n =~ /^chr\((.)\)$/u) { }
4206 0 1074 unless defined $func
4209 612 462 unless ($self->call($func))
4224 322 1720 if ($self->call($func))
4244 0 274 if defined $max and $max < 0
4249 228 84 unless $self->call($func)
4250 4 80 if $self->{'pos'} == $pos
4254 216 0 if ($count >= $min and !defined($max) || $count <= $max)
4264 0 22 if defined $max and $max < 0
4269 12 36 unless $self->call($func)
4270 4 32 if $self->{'pos'} == $pos
4274 22 0 if ($count >= $min and !defined($max) || $count <= $max)
4287 0 72 unless defined $rule
4297 0 4 unless defined $value
4299 4 0 unless ref $value
4320 86 1554 if $self->the_end
4321 0 1522 if ($self->{'pos'} >= $self->{'end'} or $self->state_curr->{'doc'} and $self->start_of_line and substr($self->{'input'}, $self->{'pos'}) =~ /^(?:---|\.\.\.)(?=\s|\z)/u)
4331 120 1434 if (substr($self->{'input'}, $self->{'pos'}, 1) eq $char)
4343 0 78 if $self->the_end
4344 76 2 if ($low le substr($self->{'input'}, $self->{'pos'}, 1) and substr($self->{'input'}, $self->{'pos'}, 1) le $high)
4359 2 174 if $self->the_end
4361 8 166 unless $self->call($funcs[0])
4365 24 226 if ($self->call($func))
4379 12 8 if $type eq "<="
4382 0 20 $type eq '!' ? :
4390 0 4 if $value == -1
4391 0 4 if $value eq "auto-detect"
4394 4 0 if ($state->{'name'} ne "all")
4397 0 44 if $i > $size - 2
4401 4 40 if $state->{'name'} eq "s_l_block_scalar"
4425 2 40 if isFunction($y)
4426 0 42 unless isNumber($y)
4446 0 18 if $i == 1
4458 6 0 unless isString($str)
4467 0 0 unless isString($str)
4475 10 0 unless isBoolean($test)
4476 4 6 if ($test)
4487 4 0 unless isNumber($x)
4488 0 4 unless isNumber($y)
4489 4 0 $x < $y ? :
4496 2 0 unless isNumber($x)
4497 0 2 unless isNumber($y)
4498 2 0 $x <= $y ? :
4524 564 2800 $self->{'pos'} == 0 || $self->{'pos'} >= $self->{'end'} || substr($self->{'input'}, $self->{'pos'} - 1, 1) eq "\n" ? :
4531 2 32 $self->{'pos'} >= $self->{'end'} ? :
4542 0 4 unless substr($self->{'input'}, $pos) =~ /^ ( (?: \ * (?:\#.*)? \n )* ) (\ *) /ux
4554 0 4 if ($in_seq and not length $pre) { }
4555 0 0 if $n == -1
4560 0 4 if $m < 0
4577 2 0 if (defined $3 and length $3) { }
4588 0 2 if $m > 0 and $pre =~ /^.{$m}\ /mu
4590 0 2 $m == 0 ? :
4602 0 0 if $ENV{'DEBUG'}
4635 0 0 if $call =~ /^($| |.* $)/u
4636 0 0 unless $self->{'trace_on'} or $call eq $self->trace_start
4640 0 0 if ($level > 0)
4646 0 0 if length $input > 30
4661 0 0 if ($ENV{'DEBUG'})
4669 0 0 if ($type eq "?" and not $self->{'trace_off'})
4672 0 0 if (grep(($_ eq $call), @{$self->trace_quiet;}))
4673 0 0 $type eq '?' ? :
4675 0 0 if ($type ne "?" and not $self->{'trace_off'})
4679 0 0 if (defined $trace_info)
4682 0 0 if ($prev_type eq "?" and $prev_level eq $level)
4684 0 0 if ($line =~ /^\d*\ *\+/u) { }
4691 0 0 if ($prev_level)
4699 0 0 if ($call eq $self->trace_start)
4706 0 0 unless @$args
4714 0 2 if (my $line = $self->{'trace_info'}[2])
4775 13 13 if (my $callback = $self->{'callback'}) { }
4785 38 6 if (defined $event->{'event'})
4786 0 38 if (my $anchor = $self->{'anchor'})
4789 0 38 if (my $tag = $self->{'tag'})
4799 52 22 if (@{$self->{'cache'};}) { }
4803 14 8 if ($event->{'event'} =~ /(mapping_start|sequence_start|scalar)/u)
4813 8 26 if $event
4818 0 6 unless my $events = pop @{$$self{"cache"};}
4820 2 4 if $event
4825 0 28 unless my $events = pop @{$$self{"cache"};}
4840 12 2 unless $self->{'document_start'}
4848 2 2 unless $self->{'document_end'}
4872 0 0 if defined $self->{'document_start'}{'version'}
4893 0 0 if defined $self->{'document_end'}
4944 0 0 length $2 ? :
4952 0 0 length $2 ? :
4962 0 0 length $2 ? :
4979 0 0 if $self->{'in_scalar'}
4994 0 2 if @$lines and $lines->[-1]{'text'} eq ""
4997 2 0 if ($t eq 'clip') { }
0 0 elsif ($t eq 'strip') { }
0 0 elsif (not $text =~ /\S/u) { }
5016 0 46 if $self->{'in_scalar'}
5020 0 26 if $self->{'in_scalar'}
5048 0 0 if ($t eq 'clip') { }
0 0 elsif ($t eq 'strip') { }
5050 0 0 if $text eq "\n"
5080 0 0 if ($tag =~ /^!<(.*)>$/u) { }
0 0 elsif ($tag =~ /^!!(.*)/u) { }
0 0 elsif ($tag =~ /^(!.*?!)/u) { }
0 0 elsif (defined($prefix = $self->{'tag_map'}{'!'})) { }
5084 0 0 if (defined($prefix = $self->{'tag_map'}{'!!'})) { }
5093 0 0 if (defined $prefix) { }
5153 1 0 if $type eq "+DOC" and $_->{'explicit'}
5154 0 1 if $type eq "-DOC" and $_->{'explicit'}
5155 0 1 if $type eq "+MAP" and $_->{'flow'}
5156 1 0 if $type eq "+SEQ" and $_->{'flow'}
5157 0 13 if $_->{'anchor'}
5158 0 13 if $_->{'tag'}
5159 0 13 if $_->{'name'}
5160 5 8 if (exists $_->{'value'})