Branch Coverage

blib/lib/YAML/Old/Loader.pm
Criterion Covered Total %
branch 201 238 84.4


line true false branch
35 1 257 if $self->stream =~ /$ESCAPE_CHAR/
37 1 256 if length $self->stream and not $$self{'stream'} =~ s/(.)\n\Z/$1/s
49 218 38 unless ($self->eos)
50 21 197 unless ($self->lines->[0] =~ /^---(\s|$)/)
64 256 0 if ($self->lines->[0] =~ /^---\s*(.*)$/) { }
70 2 15 if (defined $directives{$key})
83 256 0 unless ($self->done)
86 50 204 if ($self->done)
95 1 253 if $self->major_version ne '1'
97 1 252 if $self->minor_version ne '0'
99 1 252 unless $directives{'TAB'} =~ /^(NONE|\d+)(:HARD)?$/
104 116 113 wantarray ? :
118 16 1804 if ($anchor)
124 56 1172 if ($preface =~ s/^($FOLD_CHAR|$LIT_CHAR_RX)(-|\+)?\d*\s*//) { }
126 18 38 if defined $2
129 1 1171 if $indicator
134 17 1802 if ($alias) { }
1171 631 elsif (length $self->inline) { }
38 593 elsif ($indicator eq $LIT_CHAR) { }
17 576 elsif ($indicator eq $FOLD_CHAR) { }
135 1 16 unless defined $self->anchor2node->{$alias}
137 16 0 if (ref $self->anchor2node->{$alias} ne 'YAML-anchor2node') { }
147 1 1164 if (length $self->inline)
154 0 38 if $implicit
160 1 16 if $implicit
166 569 7 if ($self->indent == $self->offset->[$self->level]) { }
167 133 436 if ($self->content =~ /^-( |$)/) { }
436 0 elsif ($self->content =~ /(^\?|\:( |$))/) { }
0 0 elsif ($preface =~ /^\s*$/) { }
187 66 1723 if ($explicit)
188 0 66 if ($class) { }
189 0 0 unless (ref $node)
200 16 1772 if ($anchor)
201 6 10 if (ref $self->anchor2node->{$anchor} eq 'YAML-anchor2node')
222 70 46 if ($preface =~ s/^\!(\S+)\s*//) { }
5 41 elsif ($preface =~ s/^\!\s*//) { }
20 21 elsif ($preface =~ s/^\&([^ ,:]+)\s*//) { }
21 0 elsif ($preface =~ s/^\*([^ ,:]+)\s*//) { }
223 1 69 if $explicit
227 1 4 if $implicit
232 1 19 unless $token =~ /^[a-zA-Z0-9]+$/
234 1 18 if $anchor
235 0 18 if $alias
240 1 20 unless $token =~ /^[a-zA-Z0-9]+$/
242 1 19 if $alias
243 1 18 if $anchor
255 47 36 if ($explicit =~ m[^\!?perl/(hash|array|ref|scalar)(?:\:(\w(\w|\:\:)*)?)?$])
260 21 26 if ($type eq 'ref')
261 1 20 unless exists $$node{"\aYAML\aVALUE\a"} and scalar keys %$node == 1
268 3 7 if ($type eq 'scalar' and length $class and not ref $node)
273 20 26 if (length $class)
279 14 22 if ($explicit =~ m[^!?perl/(glob|regexp|code)(?:\:(\w(\w|\:\:)*)?)?$]) { }
13 9 elsif ($$YAML::Old::TagClass{$explicit} or $explicit =~ m[^perl/(\@|\$)?([a-zA-Z](\w|::)+)$]) { }
5 4 elsif (ref $node) { }
283 14 0 if ($type_class->can('yaml_load')) { }
295 4 9 if ($class->can('yaml_load')) { }
300 9 0 if (ref $node) { }
328 4 1287 if ($$self{'content'} =~ s/^\?\s*//) { }
22 1265 elsif ($$self{'content'} =~ s/^\=\s*//) { }
0 1265 elsif ($$self{'content'} =~ s/^\=\s*//) { }
351 1 1290 unless ($$self{'content'} =~ s/^:\s*//)
358 1 1288 if (exists $$mapping{$key}) { }
375 317 1 if ($self->content =~ /^-(?: (.*))?$/) { }
376 305 12 defined $1 ? :
381 33 284 if ($self->preface =~ /^(\s*)(\w.*\:(?: |$).*)$/) { }
408 0 2532 if ($anchor)
414 0 2532 if ($alias) { }
23 2509 elsif ($self->inline =~ /^\{/) { }
27 2482 elsif ($self->inline =~ /^\[/) { }
21 2461 elsif ($self->inline =~ /^"/) { }
48 2413 elsif ($self->inline =~ /^'/) { }
415 0 0 unless defined $self->anchor2node->{$alias}
417 0 0 if (ref $self->anchor2node->{$alias} ne 'YAML-anchor2node') { }
434 2 18 if $implicit
438 0 47 if $implicit
441 1079 1334 if ($top) { }
448 2404 8 unless $explicit
450 17 2508 if ($explicit)
453 0 2525 if ($anchor)
454 0 0 if (ref $self->anchor2node->{$anchor} eq 'YAML-anchor2node')
473 0 23 unless $$self{'inline'} =~ s/^\{\s*//
477 1 22 unless $$self{'inline'} =~ s/^\: \s*//
480 0 22 if (exists $$node{$key}) { }
486 13 9 if $self->inline =~ /^\s*\}/
487 0 9 unless $$self{'inline'} =~ s/^\,\s*//
500 0 27 unless $$self{'inline'} =~ s/^\[\s*//
505 17 33 if $self->inline =~ /^\s*\]/
506 1 32 unless $$self{'inline'} =~ s/^\,\s*//
517 20 1 if ($self->inline =~ /^"((?:(?:\\"|[^"]){0,32766}){0,32766})"\s*(.*)$/) { }
533 47 1 if ($self->inline =~ /^'((?:(?:''|[^']){0,32766}){0,32766})'\s*(.*)$/) { }
548 1333 1 if ($self->inline =~ /^(|[^!\@#%^&*].*?)(?=[\[\]\{\},]|, |: |- |:\s*$|$)/) { }
562 4 2403 if $value eq ''
563 3 2400 if $value =~ /^~$/
564 2398 2 unless $value =~ /^[\@\`\^]/ or $value =~ /^[\-\?]\s/
582 16 1 unless $chomp eq '+'
583 15 2 unless $chomp
596 3 35 if '+' eq $chomp
598 13 22 if $chomp eq '-'
630 0 2018 unless defined $offset
633 200 1818 if $self->eos
637 56 1762 if ($self->preface =~ qr/(?:^|\s)(?:$FOLD_CHAR|$LIT_CHAR_RX)(?:-|\+)?(\d*)\s*$/) { }
576 1347 elsif ($type == 2 and $self->preface =~ /^(\s*(\!\S*|\&\S+))*\s*$/) { }
640 1 55 if length $1 and $1 == 0
643 4 51 if (length $1) { }
649 0 1 unless $self->lines->[0] =~ /^( *)/
650 1 0 unless length $1 <= $offset
655 0 51 if $self->eos
656 50 1 if ($self->lines->[0] =~ /^( *)\S/ and length $1 > $offset) { }
669 0 576 if ($self->eos) { }
674 0 576 unless $self->lines->[0] =~ /^( *)\S/
675 574 2 if (length $1 > $offset) { }
685 216 1601 if ($type == 1) { }
698 7 1810 if $self->eos
700 38 1772 if ($self->lines->[0] =~ /^---(\s|$)/)
704 169 1603 if ($type == 1 and $self->lines->[0] =~ /^ {$offset}(.*)$/) { }
15 1588 elsif ($self->lines->[0] =~ /^\s*$/) { }
719 4 1584 if $self->offset->[$level] != length $1
724 0 1768 if $self->indent - $offset > 1
750 0 17 length $1 > 1 ? :