Branch Coverage

blib/lib/YAML/As/Parsed.pm
Criterion Covered Total %
branch 168 202 83.1


line true false branch
27 53 59 if (wantarray) { }
48 0 0 if (wantarray) { }
108 3 11 ref $_[0] ? :
111 1 13 unless my $file = shift()
112 1 12 unless -e $file
114 1 11 unless -f _
116 0 11 unless -r _
121 0 11 unless ($fh)
126 11 0 if (_can_flock())
127 0 11 unless flock $fh, 1
137 2 9 if (my $err = $@)
142 0 9 unless (close $fh)
150 1 341 ref $_[0] ? :
154 1 341 unless (defined $string)
160 1 340 if (utf8::is_utf8($string) and not utf8::valid($string))
174 4 336 unless length $string
181 3 333 if @lines and $lines[0] =~ /^\%YAML[: ][\d\.]+.*\z/
187 275 81 if ($lines[0] =~ /^---\s*(?:(.+)\s*)?\z/)
190 41 234 if (defined $1 and not $1 =~ /^(?:\#.+|\%YAML[: ][\d\.]+)\z/)
198 12 303 if (not @lines or $lines[0] =~ /^(?:---|\.\.\.)/) { }
2 301 elsif (not $in_document and @$self) { }
65 236 elsif ($lines[0] =~ /^\s*\-(?:\s|$|-+$)/) { }
236 0 elsif ($lines[0] =~ /^(\s*)\S/) { }
235 14 328 if (ref $err eq 'SCALAR') { }
0 328 elsif ($err) { }
246 5 225 unless length $string
253 1 86 unless length $string
257 13 61 if (length $1 > 1) { }
268 45 898 if $string eq "~"
271 183 715 if ($string =~ /^$re_capture_single_quoted$re_trailing_comment\z/)
276 58 657 if ($string =~ /^$re_capture_double_quoted$re_trailing_comment\z/)
281 2 655 if ($string =~ /^[\'\"!&]/)
284 10 645 if $string =~ /^{}(?:\s+\#.*)?\z/
285 10 635 if $string =~ /^\[\](?:\s+\#.*)?\z/
288 623 12 unless ($string =~ /^[>|]/)
289 8 615 if $string =~ /^(?:-(?:\s|$)|[\@\%\`])/ or $string =~ /:(?:\s|$)/
297 0 12 unless @$lines
302 0 12 if (defined $indent->[-2] and $indent->[-1] <= $indent->[-2])
310 7 27 unless length $1 >= $indent->[-1]
314 2 10 substr($string, 0, 1) eq '>' ? :
315 2 10 substr($string, 1, 1) eq '-' ? :
324 13 269 if ($lines->[0] =~ /^(?:---|\.\.\.)/)
333 26 243 if (length $1 < $indent->[-1]) { }
0 243 elsif (length $1 > $indent->[-1]) { }
339 32 211 if ($lines->[0] =~ /^(\s*\-\s+)[^\'\"]\S*\s*:(?:\s+|$)/) { }
38 173 elsif ($lines->[0] =~ /^\s*\-\s*\z/) { }
169 4 elsif ($lines->[0] =~ /^\s*\-(\s*)(.+?)\s*\z/) { }
4 0 elsif (defined $indent->[-2] and $indent->[-1] == $indent->[-2]) { }
348 2 36 unless (@$lines)
352 4 32 if ($lines->[0] =~ /^(\s*)\-/) { }
32 0 elsif ($lines->[0] =~ /^(\s*)\S/) { }
354 4 0 if ($indent->[-1] == $indent2) { }
405 3 1069 if ($lines->[0] =~ /^(?:---|\.\.\.)/)
414 159 910 if (length $1 < $indent->[-1]) { }
0 910 elsif (length $1 > $indent->[-1]) { }
424 47 863 if ($lines->[0] =~ s/^\s*$re_capture_single_quoted$re_key_value_separator//) { }
29 834 elsif ($lines->[0] =~ s/^\s*$re_capture_double_quoted$re_key_value_separator//) { }
834 0 elsif ($lines->[0] =~ s/^\s*$re_capture_unquoted_key$re_key_value_separator//) { }
0 0 elsif ($lines->[0] =~ /^\s*\?/) { }
447 1 909 if (exists $hash->{$key})
452 733 177 if (length $lines->[0]) { }
460 1 176 unless (@$lines)
464 46 130 if ($lines->[0] =~ /^(\s*)-/) { }
130 0 elsif ($lines->[0] =~ /^(\s*)./) { }
471 6 124 if ($indent->[-1] >= $indent2) { }
495 1 3 unless my $file = shift()
499 3 0 if (_can_flock()) { }
502 0 3 unless sysopen $fh, $file, $flags
508 0 3 unless flock $fh, 2
523 0 3 unless (close $fh)
532 4 263 unless ref $self and @$self
543 7 265 if (not defined $cursor) { }
17 248 elsif (not ref $cursor) { }
31 217 elsif (ref $cursor eq 'ARRAY') { }
217 0 elsif (ref $cursor eq 'HASH') { }
552 1 30 unless (@$cursor)
560 1 216 unless (%$cursor)
571 1 262 if (ref $@ eq 'SCALAR') { }
0 262 elsif ($@) { }
591 24 1061 unless defined $string
592 3 1058 unless length $string
593 80 978 if (&Scalar::Util::looks_like_number($string))
595 56 24 if ($is_key or $has_string_flag) { }
602 98 880 if ($string =~ /[\x00-\x09\x0b-\x0d\x0e-\x1f\x7f-\x9f\'\n]/)
611 191 689 if ($string =~ /(?:^[~!\@#%&*|>?:,'"`{}\[\]]|^-+$|\s|:\z)/ or $QUOTE{$string})
621 0 53 if ($$seen{&refaddr($array)}++)
628 84 33 if (not $type) { }
1 32 elsif ($type eq 'ARRAY') { }
32 0 elsif ($type eq 'HASH') { }
633 0 1 if (@$el) { }
642 31 1 if (keys %$el) { }
660 1 307 if ($$seen{&refaddr($hash)}++)
668 448 90 if (not $type) { }
26 64 elsif ($type eq 'ARRAY') { }
64 0 elsif ($type eq 'HASH') { }
673 23 3 if (@$el) { }
682 61 3 if (keys %$el) { }
710 0 0 unless $errstr_warned++
719 12 2 if (defined $HAS_FLOCK) { }
726 2 0 if $HAS_FLOCK
734 11 0 if (eval { do { 'Scalar::Util'->VERSION(1.18) } }) { }