Branch Coverage

blib/lib/YAML/Old/Loader.pm
Criterion Covered Total %
branch 203 238 85.2


line true false branch
36 1 276 if $self->stream =~ /$ESCAPE_CHAR/
48 238 38 unless ($self->eos)
49 31 207 unless ($self->lines->[0] =~ /^---(\s|$)/)
63 276 0 if ($self->lines->[0] =~ /^---\s*(.*)$/) { }
69 2 15 if (defined $directives{$key})
82 276 0 unless ($self->done)
85 53 221 if ($self->done)
95 1 273 if $self->major_version ne '1'
97 1 272 if $self->minor_version ne '0'
99 1 272 unless $directives{'TAB'} =~ /^(NONE|\d+)(:HARD)?$/
103 121 125 wantarray ? :
117 16 1877 if ($anchor)
123 56 1225 if ($preface =~ s/^($FOLD_CHAR|$LIT_CHAR_RX)(-|\+)?\d*\s*//) { }
125 18 38 if defined $2
128 1 1224 if $indicator
133 17 1875 if ($alias) { }
1224 651 elsif (length $self->inline) { }
38 613 elsif ($indicator eq $LIT_CHAR) { }
17 596 elsif ($indicator eq $FOLD_CHAR) { }
135 1 16 unless defined $self->anchor2node->{$alias}
136 16 0 if (ref $self->anchor2node->{$alias} ne 'YAML-anchor2node') { }
146 1 1217 if (length $self->inline)
153 0 38 if $implicit
159 1 16 if $implicit
165 587 9 if ($self->indent == $self->offset->[$self->level]) { }
166 139 448 if ($self->content =~ /^-( |$)/) { }
448 0 elsif ($self->content =~ /(^\?|\:( |$))/) { }
0 0 elsif ($preface =~ /^\s*$/) { }
186 66 1793 if ($explicit)
187 0 66 if ($class) { }
188 0 0 unless (ref $node)
199 16 1842 if ($anchor)
200 6 10 if (ref $self->anchor2node->{$anchor} eq 'YAML-anchor2node')
221 70 48 if ($preface =~ s/^\!(\S+)\s*//) { }
5 43 elsif ($preface =~ s/^\!\s*//) { }
21 22 elsif ($preface =~ s/^\&([^ ,:]*)\s*//) { }
22 0 elsif ($preface =~ s/^\*([^ ,:]*)\s*//) { }
222 1 69 if $explicit
226 1 4 if $implicit
231 2 19 unless $token =~ /^[a-zA-Z0-9]+$/
233 1 18 if $anchor
234 0 18 if $alias
239 2 20 unless $token =~ /^[a-zA-Z0-9]+$/
241 1 19 if $alias
242 1 18 if $anchor
254 47 36 if ($explicit =~ m[^\!?perl/(hash|array|ref|scalar)(?:\:(\w(\w|\:\:)*)?)?$])
259 21 26 if ($type eq 'ref')
261 1 20 unless exists $node->{"\aYAML\aVALUE\a"} and scalar keys %$node == 1
267 3 7 if ($type eq 'scalar' and length $class and not ref $node)
272 20 26 if (length $class)
278 14 22 if ($explicit =~ m[^!?perl/(glob|regexp|code)(?:\:(\w(\w|\:\:)*)?)?$]) { }
13 9 elsif ($YAML::TagClass->{$explicit} or $explicit =~ m[^perl/(\@|\$)?([a-zA-Z](\w|::)+)$]) { }
5 4 elsif (ref $node) { }
282 14 0 if ($type_class->can('yaml_load')) { }
294 4 9 if ($class->can('yaml_load')) { }
299 9 0 if (ref $node) { }
322 1 483 $self->preserve ? :
327 4 1339 if ($self->{'content'} =~ s/^\?\s*//) { }
22 1317 elsif ($self->{'content'} =~ s/^\=\s*//) { }
0 1317 elsif ($self->{'content'} =~ s/^\=\s*//) { }
350 1 1342 unless ($self->{'content'} =~ s/^:\s*//)
357 2 1338 if (exists $mapping->{$key}) { }
374 324 1 if ($self->content =~ /^-(?: (.*))?$/) { }
375 312 12 defined $1 ? :
386 36 288 if ($preface =~ /^ (\s*) ( \w .*? \: (?:\ |$).*) $/x or $preface =~ /^ (\s*) ((') (?:''|[^'])*? ' \s* \: (?:\ |$).*) $/x or $preface =~ /^ (\s*) ((") (?:\\\\|[^"])*? " \s* \: (?:\ |$).*) $/x) { }
416 0 2640 if ($anchor)
422 0 2640 if ($alias) { }
24 2616 elsif ($self->inline =~ /^\{/) { }
28 2588 elsif ($self->inline =~ /^\[/) { }
22 2566 elsif ($self->inline =~ /^"/) { }
52 2514 elsif ($self->inline =~ /^'/) { }
424 0 0 unless defined $self->anchor2node->{$alias}
425 0 0 if (ref $self->anchor2node->{$alias} ne 'YAML-anchor2node') { }
442 2 19 if $implicit
446 0 51 if $implicit
449 1130 1384 if ($top) { }
456 2505 8 unless $explicit
458 3 3 if ($self->numify and defined $node and not ref $node and length $node and $node =~ /\A-?(?:0|[1-9][0-9]*)?(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?\z/)
463 17 2616 if ($explicit)
466 0 2633 if ($anchor)
467 0 0 if (ref $self->anchor2node->{$anchor} eq 'YAML-anchor2node')
487 0 24 unless $self->{'inline'} =~ s/^\{\s*//
491 1 23 unless $self->{'inline'} =~ s/^\: \s*//
493 0 23 if (exists $node->{$key}) { }
499 14 9 if $self->inline =~ /^\s*\}/
501 0 9 unless $self->{'inline'} =~ s/^\,\s*//
514 0 28 unless $self->{'inline'} =~ s/^\[\s*//
518 18 33 if $self->inline =~ /^\s*\]/
520 1 32 unless $self->{'inline'} =~ s/^\,\s*//
530 21 1 if ($self->inline =~ /^"((?:(?:\\"|[^"]){0,32766}){0,32766})"\s*(.*)$/) { }
546 51 1 if ($self->inline =~ /^'((?:(?:''|[^']){0,32766}){0,32766})'\s*(.*)$/) { }
561 1383 1 if ($self->inline =~ /^(|[^!\@#%^&*].*?)(?=[\[\]\{\},]|, |: |- |:\s*$|$)/) { }
575 4 2504 if $value eq ''
576 4 2500 if $value =~ /^~$/
577 2498 2 unless $value =~ /^[\@\`]/ or $value =~ /^[\-\?]\s/
595 16 1 unless $chomp eq '+'
596 15 2 unless $chomp
609 3 35 if '+' eq $chomp
611 13 22 if $chomp eq '-'
643 0 2094 unless defined $offset
646 219 1875 if ($self->eos)
653 56 1819 if ($self->preface =~ qr/(?:^|\s)(?:$FOLD_CHAR|$LIT_CHAR_RX)(?:-|\+)?(\d*)\s*$/) { }
596 1384 elsif ($type == 2 and $self->preface =~ /^(\s*(\!\S*|\&\S+))*\s*$/) { }
656 1 55 if length $1 and $1 == 0
659 4 51 if (length $1) { }
666 1 0 unless length $1 <= $offset
671 0 51 if $self->eos
672 50 1 if ($self->lines->[0] =~ /^( *)\S/ and length $1 > $offset) { }
685 0 596 if ($self->eos) { }
690 1 595 unless $self->lines->[0] =~ /^( *)\S/
692 592 3 if (length $1 > $offset) { }
702 216 1657 if ($type == 1) { }
715 7 1866 if $self->eos
717 38 1828 if ($self->lines->[0] =~ /^---(\s|$)/)
721 169 1659 if ($type == 1 and $self->lines->[0] =~ /^ {$offset}(.*)$/) { }
15 1644 elsif ($self->lines->[0] =~ /^\s*$/) { }
736 4 1640 if $self->offset->[$level] != length $1
741 0 1824 if $self->indent - $offset > 1
767 0 18 length $1 > 1 ? :