Branch Coverage

blib/lib/JSON/JSONFold.pm
Criterion Covered Total %
branch 131 216 60.6


line true false branch
46 0 18 unless open my $out, ">", \$output
54 0 18 unless close $out
55 0 18 unless $output =~ /\n\z/u
65 0 0 unless open my $out, ">", \$output
71 0 0 unless close $out
72 0 0 unless $output =~ /\n\z/u
143 0 20 if defined $width
156 19 0 if ($gold)
162 19 0 if defined $indent
178 17 1 if $opts
191 0 0 if $opts
352 0 84 unless @_
353 39 45 @_ == 1 && ref $_[0] ? :
354 38 46 unless %$overrides
358 1 275 unless (exists $NAME_TO_INDEX{$key})
359 0 1 if $validate
369 20 19 if ref $config
373 0 19 unless exists $PRESETS{$name}
558 0 0 unless @$parts
571 169 0 length $body ? :
574 75 94 !($opener || $closer) ? :
583 75 94 $is_body ? :
584 75 94 $is_body ? :
613 45 0 if @{$other->[1];}
616 0 45 if ($other->[6] > $self->[6])
633 0 0 if @parts < 3
637 0 0 unless $part =~ /($KEY_RE)/u
650 0 0 if ($part =~ /^[\-0-9]/u) { }
0 0 elsif ($i < $last) { }
741 158 47 $self->[4] ? :
742 61 144 if ($line->[6] >= $self->[15])
751 62 52 unless ($line->[7] or $line->[8])
760 0 101 if $self->[4] > $cfg->[1]
761 4 97 if $self->[11] > $self->[6]
762 5 92 if $self->[15] >= $cfg->[7]
782 22 10 $self->[15] < $cfg->[16] ? :
783 26 6 $cfg->[11] > 0 && $self->[11] <= $self->[8] ? :
794 0 10 if $n < 2
801 6 20 if ($prev->[9] and $line->[9] and $prev->can_merge($line, $self->[7], $cfg->[1])) { }
808 6 14 if $read_pos != $write_pos
814 6 4 if $write_pos < @$lines
877 18 1 unless $cfg->[0]
889 0 19 unless defined $s
893 1 18 unless ($self->[2])
899 0 18 if ($nl < 0)
905 2 16 if ($nl2 < 0)
928 0 2 if (length $self->[3])
942 2 0 if $fh and $fh->can("flush")
949 0 1 if $self->[6]
955 47 122 if ($line->[7])
969 0 47 if $line->width > $self->[2][1]
973 2 120 unless (@{$self->[4];})
980 47 73 if ($line->[8])
981 0 47 if ($frame->[0] != $line->[8])
990 15 58 if $line->[4] >= $frame->[5]
991 15 58 if $line->[4] >= $frame->[7]
998 0 62 unless @$lines
999 47 15 unless defined $depth
1001 24 38 if ($depth < 0)
1014 107 17 if (not $frame->is_empty) { }
13 4 elsif (not $frame->[13] || $line->[10] || $line->[9]) { }
1015 90 17 unless ($frame->[14])
1017 35 23 if $line->[10] and $prev->[10] and $self->_try_pack($frame, $prev, $line)
1018 4 24 if $line->[9] and $prev->[9] and $self->_try_join($frame, $prev, $line)
1032 0 72 if ($frame->[13] and $line->width > $self->[2][1])
1036 67 5 unless ($line->[8])
1037 8 59 if ($frame->[13] and not $frame->check_fold_limits($self->[2]))
1041 0 67 if ($frame->[14] and not $line->[11])
1047 19 2 unless $frame->[13] or $frame->[14]
1055 4 35 if $prev->[4] >= $frame->[5] or $prev->[6] >= $self->[2][4]
1059 4 35 if $prev->[4] >= $frame->[7] or $prev->[6] >= $self->[2][16]
1065 0 39 if ($frame->[13] and not $frame->check_fold_limits($self->[2]))
1073 0 35 if $frame->[5] <= 1
1074 0 35 unless $prev->can_merge($line, $frame->[5], $self->[2][1])
1076 0 35 unless $prev->[10]
1082 9 1 if $frame->[0] != 2
1085 1 0 if $line_count < 2 or $line_count < $self->[2][10] or $line_count > $self->[2][11]
1090 0 0 unless @lines
1094 0 0 if $part_count < 4 or $part_count - 2 < $frame->[9]
1097 0 0 if @{$line->[1];} != $part_count
1100 0 0 if ($first->[3] == 1)
1102 0 0 unless defined $sig
1105 0 0 unless defined $line_sig and $line_sig eq $sig
1114 0 0 if $len > $max
1121 0 0 if $frame->[3][0][0] + $grided_length > $self->[2][1]
1134 0 4 if $frame->[7] <= 1
1135 0 4 unless $prev->can_merge($line, $frame->[7], $self->[2][1])
1147 10 37 if ($frame->[14])
1148 0 10 if ($self->_try_grid($frame)) { }
1158 35 12 if ($frame->[13])
1159 32 3 if ($self->_try_fold($frame))
1160 18 5 if (@{$self->[4];} and $frame->[3][0][11])
1162 11 7 if $parent->[10] == 0
1175 0 32 if not $frame->[13] or $frame->[10] != 1 or @{$frame->[3];} != 3 or $frame->[1] + $frame->[4] > $self->[2][1]
1185 0 19 unless @$lines
1189 8 11 if $keep_last
1190 15 4 if (@$lines)
1194 8 11 if $keep_last
1226 140 0 $kind == 1 ? :
95 140 $kind == 2 ? :
1257 0 0 if $^S
1331 0 0 if (defined $input) { }
1332 0 0 unless open my $fh, "<", $input
1335 0 0 unless close $fh
1361 0 0 if ($opt->{'help'})
1366 0 0 $opt->{'demo'} ? :
1371 0 0 if $verbose
1375 0 0 if $verbose