Branch Coverage

blib/lib/YAML/PP/Emitter.pm
Criterion Covered Total %
branch 313 378 82.8


line true false branch
15 0 38 $ENV{'YAML_PP_EMIT_DEBUG'} ? :
51 281 1390 unless ($self->writer)
75 31 409 if (defined $anchor)
78 39 401 if (defined $tag)
84 70 370 if ($info->{'style'} || 0) eq 2
87 31 409 if ($flow > 1) { }
88 30 1 if ($last->{'type'} eq 'SEQ') { }
0 1 elsif ($last->{'type'} eq 'MAP') { }
1 0 elsif ($last->{'type'} eq 'MAPVALUE') { }
89 0 30 if ($last->{'newline'})
92 3 27 if ($last->{'index'} == 0) { }
100 0 0 if ($last->{'newline'})
103 0 0 if ($last->{'index'} == 0) { }
111 0 1 if ($last->{'index'} == 0)
116 0 31 if ($props)
122 136 273 if ($last->{'type'} eq 'DOC') { }
126 37 236 if ($last->{'newline'})
130 62 211 if ($last->{'type'} eq 'MAPVALUE') { }
136 31 180 if (not $props and $self->indent == 1) { }
143 1 210 if ($last->{'column'}) { }
144 1 0 $self->indent > 1 ? :
150 195 16 if ($last->{'type'} eq 'SEQ') { }
11 5 elsif ($last->{'type'} eq 'MAP') { }
5 0 elsif ($last->{'type'} eq 'COMPLEXVALUE') { }
167 49 360 if ($props)
168 49 0 $last->{'column'} ? :
192 7 432 if ($last->{'index'} == 0) { }
70 362 elsif ($last->{'flow'}) { }
195 0 7 if ($last->{'zero_indent'})
198 7 0 if ($self->column) { }
207 39 31 if ($last->{'flow'} == 1)
214 225 214 if ($last->{'type'} eq 'SEQ') { }
0 214 elsif ($last->{'type'} eq 'MAP') { }
63 151 elsif ($last->{'type'} eq 'MAPVALUE') { }
11 140 elsif ($last->{'type'} eq 'COMPLEX') { }
5 135 elsif ($last->{'type'} eq 'COMPLEXVALUE') { }
242 16 428 if (defined $anchor)
245 11 433 if (defined $tag)
251 52 392 if $flow or ($info->{'style'} || 0) eq 2
254 27 417 if ($flow > 1) { }
255 23 4 if ($last->{'type'} eq 'SEQ') { }
1 3 elsif ($last->{'type'} eq 'MAP') { }
3 0 elsif ($last->{'type'} eq 'MAPVALUE') { }
256 0 23 if ($last->{'newline'})
259 2 21 if ($last->{'index'} == 0) { }
267 0 1 if ($last->{'newline'})
270 0 1 if ($last->{'index'} == 0) { }
278 0 3 if ($last->{'index'} == 0)
283 0 27 if ($props)
289 224 193 if ($last->{'type'} eq 'DOC') { }
293 14 179 if ($last->{'newline'})
297 52 141 if ($last->{'type'} eq 'MAPVALUE') { }
302 26 115 if (not $props and $self->indent == 1) { }
308 1 140 if ($last->{'column'}) { }
309 1 0 $self->indent > 1 ? :
315 135 6 if ($last->{'type'} eq 'SEQ') { }
6 0 elsif ($last->{'type'} eq 'MAP') { }
0 0 elsif ($last->{'type'} eq 'COMPLEXVALUE') { }
334 19 398 if ($props)
335 19 0 $last->{'column'} ? :
362 36 408 if ($last->{'index'} == 0) { }
42 366 elsif ($last->{'flow'}) { }
365 1 35 if ($last->{'zero_indent'})
368 36 0 $self->column ? :
370 31 5 if ($last->{'flow'} < 2)
377 20 22 if ($last->{'flow'} == 1)
384 158 286 if ($last->{'type'} eq 'SEQ') { }
1 285 elsif ($last->{'type'} eq 'MAP') { }
55 230 elsif ($last->{'type'} eq 'MAPVALUE') { }
6 224 elsif ($last->{'type'} eq 'COMPLEX') { }
0 224 elsif ($last->{'type'} eq 'COMPLEXVALUE') { }
500 178 2719 if (defined $anchor)
503 176 2721 if (defined $tag)
509 0 2897 unless defined $value
518 2215 682 if ($style == 1) { }
341 341 elsif ($style == 2) { }
87 254 elsif ($style == 4) { }
25 229 elsif ($style == 5) { }
525 0 341 if (@lines > 1)
527 0 0 if length $line
538 25 62 if ($value =~ /\A\n* +/)
542 31 56 if (not $value =~ /\n\z/) { }
10 46 elsif ($value =~ /(\n|\A)\n\z/) { }
559 24 18 if $lines[-1] ne ""
565 18 25 if ($lines[$i] =~ /^[ \t]+/)
570 11 14 if ($value =~ /\A\n* +/)
574 3 22 if ($trailing > 0) { }
10 12 elsif ($trailing < 0) { }
586 24 19 $i == $#lines ? :
587 24 19 $i == 0 ? :
588 31 12 length $line ? :
589 16 3 length $lines[$i + 1] ? :
24 19 $i == $#lines ? :
591 12 31 if ($empty) { }
592 7 5 if ($spnext and $spprev) { }
4 1 elsif (not $spnext) { }
1 0 elsif (not $got_content) { }
605 0 13 unless ($sp or $spnext)
609 12 31 if ($nl)
613 3 22 if $trailing > 0
616 0 344 unless $to_escape{$1}
645 492 2405 if ($value eq '') { }
49 2356 elsif ($value =~ /[$control_re]/) { }
646 20 472 if ($flow and $last->{'type'} ne 'MAPVALUE' and $last->{'type'} ne 'MAP') { }
2 470 elsif (not $style) { }
659 230 2667 if ($style == 2) { }
69 2598 elsif ($style == 4 or $style == 5) { }
2436 162 elsif ($style == 1) { }
660 14 216 if ($value =~ / \n/ or $value =~ /\n / or $value =~ /^\n/ or $value =~ /\n$/) { }
0 216 elsif ($value eq "\n") { }
668 2 67 if ($value eq '') { }
8 59 elsif ($flow) { }
673 8 0 if ($value =~ tr/\n//) { }
682 420 2016 if (not length $value) { }
25 1991 elsif ($value =~ /[$escape_re_without_lb]/) { }
3 1988 elsif ($value eq "\n") { }
6 1982 elsif (not $value =~ tr/ /\000-\037!-\377/c) { }
9 1973 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. ) { }
53 1920 elsif ($value =~ tr/\n//) { }
76 1844 elsif ($forbidden_first{$first}) { }
0 1844 elsif ($flow and $value =~ tr/,[]{}//) { }
0 1844 elsif (substr($value, 0, 3) =~ /^(?:---|\.\.\.)/) { }
4 1840 elsif ($value =~ /: /) { }
8 1832 elsif ($value =~ / #/) { }
21 1811 elsif ($value =~ /[: \t]\z/) { }
0 1811 elsif ($value =~ /[^\x20-\x3A\x3B-\x7E\x85\xA0-\x{D7FF}\x{E000}-\x{FEFE}\x{FF00}-\x{FFFD}\x{10000}-\x{10FFFF}]/) { }
97 1714 elsif ($forbidden_first_plus_space{$first}) { }
697 0 53 $flow ? :
721 16 81 if (length $value == 1 or substr($value, 1, 1) =~ /^\s/)
726 129 2768 if ($style == 2 and not $info->{'style'})
727 6 123 if ($value =~ tr/'// and not $value =~ tr/"//)
745 70 2827 if ($props and length $value) { }
2407 420 elsif (length $value) { }
751 250 2647 if ($flow) { }
752 36 214 if ($props and not length $value)
784 1067 1580 if ($last->{'type'} eq "MAP" or $last->{'type'} eq "SEQ")
785 267 383 if ($last->{'index'} == 0 and $last->{'newline'})
793 610 2037 if ($last->{'type'} eq 'MAP') { }
795 158 452 if ($last->{'column'}) { }
796 127 31 $self->indent > 1 ? :
802 72 538 if ($props and not length $value)
806 7 603 if ($multiline)
811 603 7 unless ($multiline)
816 478 1559 if ($last->{'type'} eq 'MAPVALUE') { }
1085 474 elsif ($last->{'type'} eq 'DOC') { }
822 100 374 if ($last->{'column'}) { }
823 79 21 $self->indent > 1 ? :
829 17 457 if ($last->{'type'} eq 'COMPLEXVALUE') { }
457 0 elsif ($last->{'type'} eq 'SEQ') { }
843 1909 128 if (length $pvalue)
844 920 989 if ($last->{'column'})
848 1932 105 unless ($multiline)
864 65 185 if ($last->{'type'} eq 'SEQ') { }
93 92 elsif ($last->{'type'} eq 'MAP') { }
92 0 elsif ($last->{'type'} eq 'MAPVALUE') { }
865 37 28 if ($last->{'index'} == 0) { }
866 33 4 if ($self->column)
876 70 23 if ($last->{'index'} == 0) { }
877 69 1 if ($self->column)
888 0 92 if ($last->{'index'} == 0)
894 10 240 if ($self->column + length($pvalue) > $self->width)
914 67 24 if ($last->{'type'} eq "MAP" or $last->{'type'} eq "SEQ")
915 0 2 if ($last->{'index'} == 0 and $last->{'newline'})
921 26 65 $last->{'column'} ? :
922 2 89 if ($flow) { }
924 0 2 if ($last->{'type'} eq 'SEQ') { }
2 0 elsif ($last->{'type'} eq 'MAP') { }
0 0 elsif ($last->{'type'} eq 'MAPVALUE') { }
925 0 0 if ($last->{'index'} == 0) { }
926 0 0 if ($flow == 1)
936 0 2 if ($last->{'index'} == 0) { }
937 0 0 if ($flow == 1)
949 0 0 if ($last->{'index'} == 0) { }
951 0 0 if ($flow == 1)
964 12 77 if ($last->{'type'} eq 'MAP') { }
970 22 55 if ($last->{'type'} eq 'MAPVALUE') { }
0 55 elsif ($last->{'type'} eq 'DOC') { }
977 2 53 if ($last->{'type'} eq 'COMPLEXVALUE') { }
0 53 elsif ($last->{'type'} eq 'COMPLEX') { }
53 0 elsif ($last->{'type'} eq 'SEQ') { }
1006 18 1427 if ($info->{'version_directive'})
1007 10 8 if ($self->{'open_ended'})
1014 297 1148 unless ($implicit)
1030 126 1318 if ($self->{'open_ended'} or not $info->{'implicit'}) { }
1049 184 42 if ($tag =~ /^\Q$key\E(.*)/)
1054 42 0 if ($tag =~ /^(!.*)/) { }
1070 440 4038 unless length $yaml
1074 1666 2372 if (length $lines[-1]) { }
1075 243 1423 if ($newlines) { }