Branch Coverage

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


line true false branch
15 0 49 $ENV{'YAML_PP_EMIT_DEBUG'} ? :
51 2242 3066 unless ($self->writer)
75 98 1842 if (defined $anchor)
78 110 1830 if (defined $tag)
84 365 1575 if ($info->{'style'} || 0) eq 2
87 138 1802 if ($flow > 1) { }
88 95 43 if ($last->{'type'} eq 'SEQ') { }
2 41 elsif ($last->{'type'} eq 'MAP') { }
41 0 elsif ($last->{'type'} eq 'MAPVALUE') { }
89 17 78 if ($last->{'newline'})
92 27 68 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 120 if ($props)
122 985 817 if ($last->{'type'} eq 'DOC') { }
126 108 709 if ($last->{'newline'})
130 263 554 if ($last->{'type'} eq 'MAPVALUE') { }
136 91 463 if (not $props and $self->indent == 1) { }
143 15 539 if ($last->{'column'}) { }
144 12 3 $self->indent > 1 ? :
150 526 28 if ($last->{'type'} eq 'SEQ') { }
19 9 elsif ($last->{'type'} eq 'MAP') { }
9 0 elsif ($last->{'type'} eq 'COMPLEXVALUE') { }
167 159 1643 if ($props)
168 153 6 $last->{'column'} ? :
192 28 1911 if ($last->{'index'} == 0) { }
359 1552 elsif ($last->{'flow'}) { }
195 0 28 if ($last->{'zero_indent'})
198 22 6 if ($self->column) { }
207 223 136 if ($last->{'flow'} == 1)
214 621 1318 if ($last->{'type'} eq 'SEQ') { }
2 1316 elsif ($last->{'type'} eq 'MAP') { }
304 1012 elsif ($last->{'type'} eq 'MAPVALUE') { }
19 993 elsif ($last->{'type'} eq 'COMPLEX') { }
9 984 elsif ($last->{'type'} eq 'COMPLEXVALUE') { }
242 44 1311 if (defined $anchor)
245 47 1308 if (defined $tag)
251 229 1126 if $flow or ($info->{'style'} || 0) eq 2
254 122 1233 if ($flow > 1) { }
255 52 70 if ($last->{'type'} eq 'SEQ') { }
14 56 elsif ($last->{'type'} eq 'MAP') { }
56 0 elsif ($last->{'type'} eq 'MAPVALUE') { }
256 0 52 if ($last->{'newline'})
259 16 36 if ($last->{'index'} == 0) { }
267 1 13 if ($last->{'newline'})
270 8 6 if ($last->{'index'} == 0) { }
278 0 56 if ($last->{'index'} == 0)
283 10 112 if ($props)
289 634 599 if ($last->{'type'} eq 'DOC') { }
293 51 548 if ($last->{'newline'})
297 245 354 if ($last->{'type'} eq 'MAPVALUE') { }
302 68 286 if (not $props and $self->indent == 1) { }
308 24 330 if ($last->{'column'}) { }
309 20 4 $self->indent > 1 ? :
315 278 76 if ($last->{'type'} eq 'SEQ') { }
47 29 elsif ($last->{'type'} eq 'MAP') { }
29 0 elsif ($last->{'type'} eq 'COMPLEXVALUE') { }
334 73 1160 if ($props)
335 68 5 $last->{'column'} ? :
362 59 1296 if ($last->{'index'} == 0) { }
212 1084 elsif ($last->{'flow'}) { }
365 7 52 if ($last->{'zero_indent'})
368 58 1 $self->column ? :
370 51 8 if ($last->{'flow'} < 2)
377 98 114 if ($last->{'flow'} == 1)
384 330 1025 if ($last->{'type'} eq 'SEQ') { }
14 1011 elsif ($last->{'type'} eq 'MAP') { }
301 710 elsif ($last->{'type'} eq 'MAPVALUE') { }
47 663 elsif ($last->{'type'} eq 'COMPLEX') { }
29 634 elsif ($last->{'type'} eq 'COMPLEXVALUE') { }
500 460 9026 if (defined $anchor)
503 492 8994 if (defined $tag)
509 0 9486 unless defined $value
518 7726 1760 if ($style == 1) { }
508 1252 elsif ($style == 2) { }
365 887 elsif ($style == 4) { }
120 767 elsif ($style == 5) { }
525 10 498 if (@lines > 1)
527 10 10 if length $line
538 36 329 if ($value =~ /\A\n* +/)
542 87 278 if (not $value =~ /\n\z/) { }
36 242 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 897 8589 if ($value eq '') { }
55 8534 elsif ($value =~ /[$control_re]/) { }
646 24 873 if ($flow and $last->{'type'} ne 'MAPVALUE' and $last->{'type'} ne 'MAP') { }
2 871 elsif (not $style) { }
659 356 9130 if ($style == 2) { }
444 8686 elsif ($style == 4 or $style == 5) { }
8112 574 elsif ($style == 1) { }
660 16 340 if ($value =~ / \n/ or $value =~ /\n / or $value =~ /^\n/ or $value =~ /\n$/) { }
0 340 elsif ($value eq "\n") { }
668 22 422 if ($value eq '') { }
69 353 elsif ($flow) { }
673 61 8 if ($value =~ tr/\n//) { }
682 772 7340 if (not length $value) { }
52 7288 elsif ($value =~ /[$escape_re_without_lb]/) { }
8 7280 elsif ($value eq "\n") { }
10 7270 elsif (not $value =~ tr/ //c) { }
12 7258 elsif (not $value =~ tr/\n //c) { }
134 7124 elsif ($value =~ tr/\n//) { }
94 7030 elsif ($forbidden_first{$first}) { }
5 7025 elsif ($flow and $value =~ tr/,[]{}//) { }
12 7013 elsif (substr($value, 0, 3) =~ /^(?:---|\.\.\.)/) { }
8 7005 elsif ($value =~ /: /) { }
8 6997 elsif ($value =~ / #/) { }
27 6970 elsif ($value =~ /[: \t]\z/) { }
0 6970 elsif ($value =~ /[^\x20-\x3A\x3B-\x7E\x85\xA0-\x{D7FF}\x{E000}-\x{FEFE}\x{FF00}-\x{FFFD}\x{10000}-\x{10FFFF}]/) { }
211 6759 elsif ($forbidden_first_plus_space{$first}) { }
697 2 132 $flow ? :
721 16 195 if (length $value == 1 or substr($value, 1, 1) =~ /^\s/)
726 158 9328 if ($style == 2 and not $info->{'style'})
727 20 138 if ($value =~ tr/'// and not $value =~ tr/"//)
745 524 8962 if ($props and length $value) { }
8190 772 elsif (length $value) { }
751 1415 8071 if ($flow) { }
752 52 1363 if ($props and not length $value)
784 4220 3851 if ($last->{'type'} eq "MAP" or $last->{'type'} eq "SEQ")
785 994 1323 if ($last->{'index'} == 0 and $last->{'newline'})
793 2733 5338 if ($last->{'type'} eq 'MAP') { }
795 448 2285 if ($last->{'column'}) { }
796 360 88 $self->indent > 1 ? :
802 100 2633 if ($props and not length $value)
806 17 2716 if ($multiline)
811 2716 17 unless ($multiline)
816 2155 3183 if ($last->{'type'} eq 'MAPVALUE') { }
1654 1529 elsif ($last->{'type'} eq 'DOC') { }
822 260 1269 if ($last->{'column'}) { }
823 204 56 $self->indent > 1 ? :
829 42 1487 if ($last->{'type'} eq 'COMPLEXVALUE') { }
1487 0 elsif ($last->{'type'} eq 'SEQ') { }
843 5044 294 if (length $pvalue)
844 3881 1163 if ($last->{'column'})
848 4870 468 unless ($multiline)
864 326 1089 if ($last->{'type'} eq 'SEQ') { }
589 500 elsif ($last->{'type'} eq 'MAP') { }
500 0 elsif ($last->{'type'} eq 'MAPVALUE') { }
865 168 158 if ($last->{'index'} == 0) { }
866 131 37 if ($self->column)
876 347 242 if ($last->{'index'} == 0) { }
877 237 110 if ($self->column)
888 0 500 if ($last->{'index'} == 0)
894 51 1364 if ($self->column + length($pvalue) > $self->width)
914 107 95 if ($last->{'type'} eq "MAP" or $last->{'type'} eq "SEQ")
915 12 5 if ($last->{'index'} == 0 and $last->{'newline'})
921 106 96 $last->{'column'} ? :
922 27 175 if ($flow) { }
924 5 22 if ($last->{'type'} eq 'SEQ') { }
7 15 elsif ($last->{'type'} eq 'MAP') { }
15 0 elsif ($last->{'type'} eq 'MAPVALUE') { }
925 1 4 if ($last->{'index'} == 0) { }
926 0 1 if ($flow == 1)
936 2 5 if ($last->{'index'} == 0) { }
937 0 2 if ($flow == 1)
949 0 15 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 3255 if ($info->{'version_directive'})
1007 10 8 if ($self->{'open_ended'})
1014 1196 2077 unless ($implicit)
1030 243 3029 if ($self->{'open_ended'} or not $info->{'implicit'}) { }
1049 487 162 if ($tag =~ /^\Q$key\E(.*)/)
1054 107 55 if ($tag =~ /^(!.*)/) { }
1070 1954 13154 unless length $yaml
1074 6978 6176 if (length $lines[-1]) { }
1075 881 6097 if ($newlines) { }