Branch Coverage

blib/lib/JSON/JSONFold.pm
Criterion Covered Total %
branch 137 242 56.6


line true false branch
15 0 5 if defined $BACKEND
17 0 5 if (defined $backend) { }
18 0 0 if $backend =~ /^\w+/u
20 5 0 if eval { do { require JSON::MaybeXS } }
22 5 0 if ($backend)
23 0 5 unless eval "require $backend"
61 0 18 unless open my $out, ">:utf8", \$output
69 0 18 unless close $out
70 0 18 unless $output =~ /\n\z/u
80 0 0 unless open my $out, ">", \$output
86 0 0 unless close $out
87 0 0 unless $output =~ /\n\z/u
99 0 0 unless $stream->close
115 0 1 unless $stream->close
176 0 20 if defined $width
189 19 0 if ($gold)
199 19 0 if $indent and $json->can("indent_length")
215 17 1 if $opts
228 0 0 if $opts
389 0 84 unless @_
390 39 45 @_ == 1 && ref $_[0] ? :
391 38 46 unless %$overrides
395 1 275 unless (exists $NAME_TO_INDEX{$key})
396 0 1 if $validate
406 20 19 if ref $config
410 0 19 unless exists $PRESETS{$name}
595 0 0 unless @$parts
608 169 0 length $body ? :
611 75 94 !($opener || $closer) ? :
620 75 94 $is_body ? :
621 75 94 $is_body ? :
650 45 0 if @{$other->[1];}
653 0 45 if ($other->[6] > $self->[6])
670 0 0 if @parts < 3
674 0 0 unless $part =~ /($KEY_RE)/u
687 0 0 if ($part =~ /^[\-0-9]/u) { }
0 0 elsif ($i < $last) { }
778 158 47 $self->[4] ? :
779 61 144 if ($line->[6] >= $self->[15])
788 62 52 unless ($line->[7] or $line->[8])
797 0 101 if $self->[4] > $cfg->[1]
798 4 97 if $self->[11] > $self->[6]
799 5 92 if $self->[15] >= $cfg->[7]
819 22 10 $self->[15] < $cfg->[16] ? :
820 26 6 $cfg->[11] > 0 && $self->[11] <= $self->[8] ? :
831 0 10 if $n < 2
838 6 20 if ($prev->[9] and $line->[9] and $prev->can_merge($line, $self->[7], $cfg->[1])) { }
845 6 14 if $read_pos != $write_pos
851 6 4 if $write_pos < @$lines
915 18 1 unless $cfg->[0]
927 0 19 unless defined $s
931 1 18 unless ($self->[2])
937 0 18 if ($nl < 0)
943 2 16 if ($nl2 < 0)
966 0 0 unless defined $s
970 0 0 unless ($self->[2])
976 0 0 if ($nl < 0)
982 0 0 if ($nl2 < 0)
1010 0 2 if (length $self->[3])
1024 2 0 if $fh and $fh->can("flush")
1031 0 1 if $self->[6]
1038 47 122 if ($line->[7])
1052 0 47 if $line->width > $self->[2][1]
1056 2 120 unless (@{$self->[4];})
1063 47 73 if ($line->[8])
1064 0 47 if ($frame->[0] != $line->[8])
1073 15 58 if $line->[4] >= $frame->[5]
1074 15 58 if $line->[4] >= $frame->[7]
1081 0 62 unless @$lines
1082 47 15 unless defined $depth
1084 24 38 if ($depth < 0)
1097 107 17 if (not $frame->is_empty) { }
13 4 elsif (not $frame->[13] || $line->[10] || $line->[9]) { }
1098 90 17 unless ($frame->[14])
1100 35 23 if $line->[10] and $prev->[10] and $self->_try_pack($frame, $prev, $line)
1101 4 24 if $line->[9] and $prev->[9] and $self->_try_join($frame, $prev, $line)
1115 0 72 if ($frame->[13] and $line->width > $self->[2][1])
1119 67 5 unless ($line->[8])
1120 8 59 if ($frame->[13] and not $frame->check_fold_limits($self->[2]))
1124 0 67 if ($frame->[14] and not $line->[11])
1130 19 2 unless $frame->[13] or $frame->[14]
1138 4 35 if $prev->[4] >= $frame->[5] or $prev->[6] >= $self->[2][4]
1142 4 35 if $prev->[4] >= $frame->[7] or $prev->[6] >= $self->[2][16]
1148 0 39 if ($frame->[13] and not $frame->check_fold_limits($self->[2]))
1156 0 35 if $frame->[5] <= 1
1157 0 35 unless $prev->can_merge($line, $frame->[5], $self->[2][1])
1159 0 35 unless $prev->[10]
1165 9 1 if $frame->[0] != 2
1168 1 0 if $line_count < 2 or $line_count < $self->[2][10] or $line_count > $self->[2][11]
1173 0 0 unless @lines
1177 0 0 if $part_count < 4 or $part_count - 2 < $frame->[9]
1180 0 0 if @{$line->[1];} != $part_count
1183 0 0 if ($first->[3] == 1)
1185 0 0 unless defined $sig
1188 0 0 unless defined $line_sig and $line_sig eq $sig
1197 0 0 if $len > $max
1204 0 0 if $frame->[3][0][0] + $grided_length > $self->[2][1]
1217 0 4 if $frame->[7] <= 1
1218 0 4 unless $prev->can_merge($line, $frame->[7], $self->[2][1])
1230 10 37 if ($frame->[14])
1231 0 10 if ($self->_try_grid($frame)) { }
1241 35 12 if ($frame->[13])
1242 32 3 if ($self->_try_fold($frame))
1243 18 5 if (@{$self->[4];} and $frame->[3][0][11])
1245 11 7 if $parent->[10] == 0
1258 0 32 if not $frame->[13] or $frame->[10] != 1 or @{$frame->[3];} != 3 or $frame->[1] + $frame->[4] > $self->[2][1]
1268 0 19 unless @$lines
1272 8 11 if $keep_last
1273 15 4 if (@$lines)
1277 8 11 if $keep_last
1309 140 0 $kind == 1 ? :
95 140 $kind == 2 ? :
1340 0 0 if $^S
1414 0 0 if (defined $input) { }
1415 0 0 unless open my $fh, "<", $input
1418 0 0 unless close $fh
1444 0 0 if ($opt->{'help'})
1450 0 0 $opt->{'demo'} ? :
1455 0 0 if $verbose
1456 0 0 if $verbose
1460 0 0 if $verbose