Branch Coverage

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


line true false branch
15 0 38 $ENV{'YAML_PP_EMIT_DEBUG'} ? :
51 2180 3019 unless ($self->writer)
75 98 1783 if (defined $anchor)
78 109 1772 if (defined $tag)
84 320 1561 if ($info->{'style'} || 0) eq 2
87 135 1746 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 955 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 1588 if ($props)
168 153 5 $last->{'column'} ? :
192 25 1855 if ($last->{'index'} == 0) { }
317 1538 elsif ($last->{'flow'}) { }
195 0 25 if ($last->{'zero_indent'})
198 20 5 if ($self->column) { }
207 184 133 if ($last->{'flow'} == 1)
214 597 1283 if ($last->{'type'} eq 'SEQ') { }
2 1281 elsif ($last->{'type'} eq 'MAP') { }
299 982 elsif ($last->{'type'} eq 'MAPVALUE') { }
19 963 elsif ($last->{'type'} eq 'COMPLEX') { }
9 954 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 8816 if (defined $anchor)
503 489 8786 if (defined $tag)
509 0 9275 unless defined $value
518 7542 1733 if ($style == 1) { }
499 1234 elsif ($style == 2) { }
364 870 elsif ($style == 4) { }
120 750 elsif ($style == 5) { }
525 10 489 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 886 8389 if ($value eq '') { }
55 8334 elsif ($value =~ /[$control_re]/) { }
646 24 862 if ($flow and $last->{'type'} ne 'MAPVALUE' and $last->{'type'} ne 'MAP') { }
2 860 elsif (not $style) { }
659 353 8922 if ($style == 2) { }
443 8479 elsif ($style == 4 or $style == 5) { }
7922 557 elsif ($style == 1) { }
660 16 337 if ($value =~ / \n/ or $value =~ /\n / or $value =~ /^\n/ or $value =~ /\n$/) { }
0 337 elsif ($value eq "\n") { }
668 22 421 if ($value eq '') { }
69 352 elsif ($flow) { }
673 61 8 if ($value =~ tr/\n//) { }
682 762 7160 if (not length $value) { }
52 7108 elsif ($value =~ /[$escape_re_without_lb]/) { }
8 7100 elsif ($value eq "\n") { }
10 7090 elsif (not $value =~ tr/ /\000-\037!-\377/c) { }
12 7078 elsif (not Deparse error: Can't locate object method "unctrl" via package " " (perhaps you forgot to load " "?) at /usr/local/lib/perl5/5.26.1/B/Deparse.pm line 5203. ) { }
134 6944 elsif ($value =~ tr/\n//) { }
94 6850 elsif ($forbidden_first{$first}) { }
5 6845 elsif ($flow and $value =~ tr/,[]{}//) { }
12 6833 elsif (substr($value, 0, 3) =~ /^(?:---|\.\.\.)/) { }
8 6825 elsif ($value =~ /: /) { }
8 6817 elsif ($value =~ / #/) { }
21 6796 elsif ($value =~ /[: \t]\z/) { }
0 6796 elsif ($value =~ /[^\x20-\x3A\x3B-\x7E\x85\xA0-\x{D7FF}\x{E000}-\x{FEFE}\x{FF00}-\x{FFFD}\x{10000}-\x{10FFFF}]/) { }
204 6592 elsif ($forbidden_first_plus_space{$first}) { }
697 2 132 $flow ? :
721 16 188 if (length $value == 1 or substr($value, 1, 1) =~ /^\s/)
726 157 9118 if ($style == 2 and not $info->{'style'})
727 20 137 if ($value =~ tr/'// and not $value =~ tr/"//)
745 522 8753 if ($props and length $value) { }
7991 762 elsif (length $value) { }
751 1247 8028 if ($flow) { }
752 50 1197 if ($props and not length $value)
784 4189 3839 if ($last->{'type'} eq "MAP" or $last->{'type'} eq "SEQ")
785 985 1316 if ($last->{'index'} == 0 and $last->{'newline'})
793 2712 5316 if ($last->{'type'} eq 'MAP') { }
795 447 2265 if ($last->{'column'}) { }
796 359 88 $self->indent > 1 ? :
802 100 2612 if ($props and not length $value)
806 17 2695 if ($multiline)
811 2695 17 unless ($multiline)
816 2144 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 5023 293 if (length $pvalue)
844 3860 1163 if ($last->{'column'})
848 4849 467 unless ($multiline)
864 271 976 if ($last->{'type'} eq 'SEQ') { }
529 447 elsif ($last->{'type'} eq 'MAP') { }
447 0 elsif ($last->{'type'} eq 'MAPVALUE') { }
865 142 129 if ($last->{'index'} == 0) { }
866 108 34 if ($self->column)
876 306 223 if ($last->{'index'} == 0) { }
877 204 102 if ($self->column)
888 0 447 if ($last->{'index'} == 0)
894 51 1196 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 3207 if ($info->{'version_directive'})
1007 10 8 if ($self->{'open_ended'})
1014 1175 2050 unless ($implicit)
1030 241 2983 if ($self->{'open_ended'} or not $info->{'implicit'}) { }
1049 482 162 if ($tag =~ /^\Q$key\E(.*)/)
1054 107 55 if ($tag =~ /^(!.*)/) { }
1070 1898 12789 unless length $yaml
1074 6696 6093 if (length $lines[-1]) { }
1075 867 5829 if ($newlines) { }