Branch Coverage

blib/lib/YAML/PP/Emitter.pm
Criterion Covered Total %
branch 351 378 92.8


line true false branch
15 0 46 $ENV{'YAML_PP_EMIT_DEBUG'} ? :
51 2193 3027 unless ($self->writer)
75 98 1791 if (defined $anchor)
78 109 1780 if (defined $tag)
84 321 1568 if ($info->{'style'} || 0) eq 2
87 135 1754 if ($flow > 1) { }
88 92 43 if ($last->{'type'} eq 'SEQ') { }
2 41 elsif ($last->{'type'} eq 'MAP') { }
41 0 elsif ($last->{'type'} eq 'MAPVALUE') { }
89 17 75 if ($last->{'newline'})
92 27 65 if ($last->{'index'} == 0) { }
100 0 2 if ($last->{'newline'})
103 2 0 if ($last->{'index'} == 0) { }
111 0 41 if ($last->{'index'} == 0)
116 18 117 if ($props)
122 963 791 if ($last->{'type'} eq 'DOC') { }
126 104 687 if ($last->{'newline'})
130 258 533 if ($last->{'type'} eq 'MAPVALUE') { }
136 91 442 if (not $props and $self->indent == 1) { }
143 14 519 if ($last->{'column'}) { }
144 11 3 $self->indent > 1 ? :
150 505 28 if ($last->{'type'} eq 'SEQ') { }
19 9 elsif ($last->{'type'} eq 'MAP') { }
9 0 elsif ($last->{'type'} eq 'COMPLEXVALUE') { }
167 158 1596 if ($props)
168 153 5 $last->{'column'} ? :
192 25 1863 if ($last->{'index'} == 0) { }
318 1545 elsif ($last->{'flow'}) { }
195 0 25 if ($last->{'zero_indent'})
198 20 5 if ($self->column) { }
207 185 133 if ($last->{'flow'} == 1)
214 597 1291 if ($last->{'type'} eq 'SEQ') { }
2 1289 elsif ($last->{'type'} eq 'MAP') { }
299 990 elsif ($last->{'type'} eq 'MAPVALUE') { }
19 971 elsif ($last->{'type'} eq 'COMPLEX') { }
9 962 elsif ($last->{'type'} eq 'COMPLEXVALUE') { }
242 43 1263 if (defined $anchor)
245 46 1260 if (defined $tag)
251 198 1108 if $flow or ($info->{'style'} || 0) eq 2
254 108 1198 if ($flow > 1) { }
255 49 59 if ($last->{'type'} eq 'SEQ') { }
12 47 elsif ($last->{'type'} eq 'MAP') { }
47 0 elsif ($last->{'type'} eq 'MAPVALUE') { }
256 0 49 if ($last->{'newline'})
259 14 35 if ($last->{'index'} == 0) { }
267 1 11 if ($last->{'newline'})
270 7 5 if ($last->{'index'} == 0) { }
278 0 47 if ($last->{'index'} == 0)
283 8 100 if ($props)
289 617 581 if ($last->{'type'} eq 'DOC') { }
293 50 531 if ($last->{'newline'})
297 240 341 if ($last->{'type'} eq 'MAPVALUE') { }
302 68 273 if (not $props and $self->indent == 1) { }
308 21 320 if ($last->{'column'}) { }
309 17 4 $self->indent > 1 ? :
315 265 76 if ($last->{'type'} eq 'SEQ') { }
47 29 elsif ($last->{'type'} eq 'MAP') { }
29 0 elsif ($last->{'type'} eq 'COMPLEXVALUE') { }
334 73 1125 if ($props)
335 68 5 $last->{'column'} ? :
362 56 1250 if ($last->{'index'} == 0) { }
184 1066 elsif ($last->{'flow'}) { }
365 6 50 if ($last->{'zero_indent'})
368 55 1 $self->column ? :
370 48 8 if ($last->{'flow'} < 2)
377 84 100 if ($last->{'flow'} == 1)
384 314 992 if ($last->{'type'} eq 'SEQ') { }
12 980 elsif ($last->{'type'} eq 'MAP') { }
287 693 elsif ($last->{'type'} eq 'MAPVALUE') { }
47 646 elsif ($last->{'type'} eq 'COMPLEX') { }
29 617 elsif ($last->{'type'} eq 'COMPLEXVALUE') { }
500 459 8836 if (defined $anchor)
503 489 8806 if (defined $tag)
509 0 9295 unless defined $value
518 7555 1740 if ($style == 1) { }
506 1234 elsif ($style == 2) { }
364 870 elsif ($style == 4) { }
120 750 elsif ($style == 5) { }
525 10 496 if (@lines > 1)
527 10 10 if length $line
538 36 328 if ($value =~ /\A\n* +/)
542 87 277 if (not $value =~ /\n\z/) { }
36 241 elsif ($value =~ /(\n|\A)\n\z/) { }
559 119 99 if $lines[-1] ne ""
565 31 180 if ($lines[$i] =~ /^[ \t]+/)
570 19 101 if ($value =~ /\A\n* +/)
574 3 117 if ($trailing > 0) { }
24 93 elsif ($trailing < 0) { }
586 119 92 $i == $#lines ? :
587 119 92 $i == 0 ? :
588 164 47 length $line ? :
589 55 37 length $lines[$i + 1] ? :
119 92 $i == $#lines ? :
591 47 164 if ($empty) { }
592 8 39 if ($spnext and $spprev) { }
37 2 elsif (not $spnext) { }
1 1 elsif (not $got_content) { }
605 32 101 unless ($sp or $spnext)
609 78 133 if ($nl)
613 3 117 if $trailing > 0
616 0 722 unless $to_escape{$1}
645 887 8408 if ($value eq '') { }
55 8353 elsif ($value =~ /[$control_re]/) { }
646 24 863 if ($flow and $last->{'type'} ne 'MAPVALUE' and $last->{'type'} ne 'MAP') { }
2 861 elsif (not $style) { }
659 354 8941 if ($style == 2) { }
443 8498 elsif ($style == 4 or $style == 5) { }
7941 557 elsif ($style == 1) { }
660 16 338 if ($value =~ / \n/ or $value =~ /\n / or $value =~ /^\n/ or $value =~ /\n$/) { }
0 338 elsif ($value eq "\n") { }
668 22 421 if ($value eq '') { }
69 352 elsif ($flow) { }
673 61 8 if ($value =~ tr/\n//) { }
682 762 7179 if (not length $value) { }
52 7127 elsif ($value =~ /[$escape_re_without_lb]/) { }
8 7119 elsif ($value eq "\n") { }
10 7109 elsif (not $value =~ tr/ //c) { }
12 7097 elsif (not $value =~ tr/\n //c) { }
134 6963 elsif ($value =~ tr/\n//) { }
94 6869 elsif ($forbidden_first{$first}) { }
5 6864 elsif ($flow and $value =~ tr/,[]{}//) { }
12 6852 elsif (substr($value, 0, 3) =~ /^(?:---|\.\.\.)/) { }
8 6844 elsif ($value =~ /: /) { }
8 6836 elsif ($value =~ / #/) { }
27 6809 elsif ($value =~ /[: \t]\z/) { }
0 6809 elsif ($value =~ /[^\x20-\x3A\x3B-\x7E\x85\xA0-\x{D7FF}\x{E000}-\x{FEFE}\x{FF00}-\x{FFFD}\x{10000}-\x{10FFFF}]/) { }
204 6605 elsif ($forbidden_first_plus_space{$first}) { }
697 2 132 $flow ? :
721 16 188 if (length $value == 1 or substr($value, 1, 1) =~ /^\s/)
726 158 9137 if ($style == 2 and not $info->{'style'})
727 20 138 if ($value =~ tr/'// and not $value =~ tr/"//)
745 522 8773 if ($props and length $value) { }
8011 762 elsif (length $value) { }
751 1249 8046 if ($flow) { }
752 50 1199 if ($props and not length $value)
784 4198 3848 if ($last->{'type'} eq "MAP" or $last->{'type'} eq "SEQ")
785 992 1316 if ($last->{'index'} == 0 and $last->{'newline'})
793 2721 5325 if ($last->{'type'} eq 'MAP') { }
795 447 2274 if ($last->{'column'}) { }
796 359 88 $self->indent > 1 ? :
802 100 2621 if ($props and not length $value)
806 17 2704 if ($multiline)
811 2704 17 unless ($multiline)
816 2153 3172 if ($last->{'type'} eq 'MAPVALUE') { }
1653 1519 elsif ($last->{'type'} eq 'DOC') { }
822 260 1259 if ($last->{'column'}) { }
823 204 56 $self->indent > 1 ? :
829 42 1477 if ($last->{'type'} eq 'COMPLEXVALUE') { }
1477 0 elsif ($last->{'type'} eq 'SEQ') { }
843 5032 293 if (length $pvalue)
844 3869 1163 if ($last->{'column'})
848 4858 467 unless ($multiline)
864 271 978 if ($last->{'type'} eq 'SEQ') { }
530 448 elsif ($last->{'type'} eq 'MAP') { }
448 0 elsif ($last->{'type'} eq 'MAPVALUE') { }
865 142 129 if ($last->{'index'} == 0) { }
866 108 34 if ($self->column)
876 307 223 if ($last->{'index'} == 0) { }
877 205 102 if ($self->column)
888 0 448 if ($last->{'index'} == 0)
894 51 1198 if ($self->column + length($pvalue) > $self->width)
914 105 94 if ($last->{'type'} eq "MAP" or $last->{'type'} eq "SEQ")
915 12 5 if ($last->{'index'} == 0 and $last->{'newline'})
921 103 96 $last->{'column'} ? :
922 24 175 if ($flow) { }
924 4 20 if ($last->{'type'} eq 'SEQ') { }
6 14 elsif ($last->{'type'} eq 'MAP') { }
14 0 elsif ($last->{'type'} eq 'MAPVALUE') { }
925 1 3 if ($last->{'index'} == 0) { }
926 0 1 if ($flow == 1)
936 2 4 if ($last->{'index'} == 0) { }
937 0 2 if ($flow == 1)
949 0 14 if ($last->{'index'} == 0) { }
951 0 0 if ($flow == 1)
964 25 150 if ($last->{'type'} eq 'MAP') { }
970 77 73 if ($last->{'type'} eq 'MAPVALUE') { }
0 73 elsif ($last->{'type'} eq 'DOC') { }
977 3 70 if ($last->{'type'} eq 'COMPLEXVALUE') { }
0 70 elsif ($last->{'type'} eq 'COMPLEX') { }
70 0 elsif ($last->{'type'} eq 'SEQ') { }
1006 18 3215 if ($info->{'version_directive'})
1007 10 8 if ($self->{'open_ended'})
1014 1183 2050 unless ($implicit)
1030 241 2991 if ($self->{'open_ended'} or not $info->{'implicit'}) { }
1049 482 162 if ($tag =~ /^\Q$key\E(.*)/)
1054 107 55 if ($tag =~ /^(!.*)/) { }
1070 1906 12818 unless length $yaml
1074 6715 6103 if (length $lines[-1]) { }
1075 874 5841 if ($newlines) { }