Branch Coverage

blib/lib/YAML/Dumper.pm
Criterion Covered Total %
branch 155 172 90.1


line true false branch
49 4 162 if (not $self->use_header and $self->document == 1)
52 1 3 unless ref($node) =~ /^(HASH|ARRAY)$/
54 1 2 if ref $node eq 'HASH' and keys %$node == 0
56 1 1 if ref $node eq 'ARRAY' and @$node == 0
64 0 162 if ($self->use_version)
78 4 1495 if ($type eq 'GLOB')
86 11 1484 if (ref $_[0] eq 'Regexp')
92 950 534 unless (ref $_[0])
93 0 950 if $self->purity
102 2 532 if ref $value and not $type
105 11 521 if ($self->transferred->{$node_id})
108 9 2 ref $self->transferred->{$node_id} ? :
114 9 512 if ($type eq 'CODE')
128 34 478 if (defined $class)
129 5 29 if ($value->can('yaml_dump')) { }
7 22 elsif ($type eq 'SCALAR') { }
150 4 501 if (defined 'YAML'->global_object->{'blessed_map'}{$node_id})
159 31 470 if ($type eq 'REF' or $type eq 'SCALAR') { }
2 468 elsif ($type eq 'GLOB') { }
180 3 496 if ++$self->{'id_refcnt'}{$node_id} > 1
183 436 60 if ($type eq 'HASH') { }
60 0 elsif ($type eq 'ARRAY') { }
215 536 956 if ($ref) { }
216 11 525 if ($ref eq 'Regexp')
231 95 1386 if (defined $self->transferred->{$node_id}) { }
5 1381 elsif ($ynode = ynode($value)) { }
234 77 18 if (ref $value) { }
235 77 0 defined $ynode ? :
241 18 0 defined $ynode ? :
254 1476 5 if ($self->use_aliases)
256 20 1456 if ($self->{'id_refcnt'}{$node_id} > 1)
257 11 9 if (defined $self->{'id_anchor'}{$node_id})
267 2 1468 if ref $value and not $type
269 16 1452 if $type eq 'SCALAR' and $tag
271 952 500 if $type eq 'SCALAR'
273 440 60 if $type eq 'HASH'
275 60 0 if $type eq 'ARRAY'
285 61 379 if $tag
289 0 440 if $@
290 8 432 if $empty_hash
294 20 412 if ($context == 5 and $self->compress_series and not defined $self->{'id_anchor'}{$node_id} || $tag || $empty_hash) { }
303 412 0 unless $self->headless and not $self->headless(0)
311 431 1 if ($self->sort_keys == 1) { }
0 1 elsif ($self->sort_keys == 2) { }
1 0 elsif (ref $self->sort_keys eq 'ARRAY') { }
312 65 366 if (ynode($value)) { }
328 3 0 defined $order{$a} && defined $order{$b} ? :
336 36 396 if (exists $$value{&VALUE})
338 36 0 if ($keys[$i] eq &VALUE)
359 7 53 if $tag
361 4 56 if @$value == 0
363 55 1 unless $self->headless and not $self->headless(0)
367 2 2 if ($self->inline_series and @$value <= $self->inline_series and not scalar grep({/\n/ unless ref $_;} @$value))
369 5 3 unless ref $_
375 2 3 if $i == $#{$value;}
397 1176 20 unless $context == 5
426 1201 981 $type == 3 ? :
427 1201 981 $type == 3 ? :
428 1201 981 $type == 3 ? :
432 4 2178 unless defined $_[0]
436 37 2141 if $_[0] eq "\aYAML\aVALUE\a"
438 1 2140 if $_[0] =~ /$ESCAPE_CHAR/
442 28 2112 if ($_[0] =~ /\n/)
443 1 27 if $self->use_block
447 0 27 if $self->use_fold
449 7 20 if length $_[0] <= 30
453 2 18 unless $_[0] =~ /\n\s*\S/
461 64 2048 if $self->is_literal_number($_[0])
465 1999 49 if $self->is_valid_plain($_[0])
469 1 48 if $_[0] =~ /'/
499 6 2042 unless length $_[0]
500 6 2036 if $self->quote_numeric_strings and &Scalar::Util::looks_like_number($_[0])
502 17 2019 if $_[0] =~ /^[\s\{\[\~\`\'\"\!\@\#\>\|\%\&\?\*\^]/
503 9 2010 if $_[0] =~ /[\{\[\]\},]/
504 4 2006 if $_[0] =~ /[:\-\?]\s/
505 1 2005 if $_[0] =~ /\s#/
506 0 2005 if $_[0] =~ /\:(\s|$)/
507 4 2001 if $_[0] =~ /[\s\|\>]$/
508 1 2000 if $_[0] eq '-'
509 1 1999 if $_[0] eq '='
518 1 10 length $1 > 1 ? :
11 8 length $1 ? :
519 0 19 unless defined $value
521 0 19 if $value =~ /^\s/
528 2063 4 defined $_[0] ? :
554 0 19 unless length $text