Branch Coverage

blib/lib/JSON/JSONFold.pm
Criterion Covered Total %
branch 105 158 66.4


line true false branch
46 0 18 unless open my $out, ">", \$output
56 0 18 unless close $out
57 0 18 unless $output =~ /\n\z/u
67 0 0 unless open my $out, ">", \$output
75 0 0 unless close $out
76 0 0 unless $output =~ /\n\z/u
147 0 20 if $width
160 19 0 if ($gold)
166 19 0 if defined $indent
182 17 1 if $opts
195 0 0 if $opts
367 0 74 unless @_
368 39 35 @_ == 1 && ref $_[0] ? :
369 38 36 unless %$overrides
374 1 170 unless (exists $NAME_TO_INDEX{$key})
375 0 1 if $validate
387 20 19 if ref $config
391 0 19 unless defined $config
504 73 96 $parent_kind && !$opener && !$closer ? :
549 0 45 if ($other->[5] > $self->[5])
629 51 53 if ($line->[5] >= $self->[11])
708 18 1 unless $cfg->[0]
720 0 19 unless defined $s
724 1 18 unless ($self->[2])
730 0 18 if ($nl < 0)
736 2 16 if ($nl2 < 0)
759 0 20 if (length $self->[3])
773 20 0 if $fh and $fh->can("flush")
780 0 1 if $self->[6]
786 47 122 if ($line->[6])
799 47 75 if ($line->[7])
805 73 2 if (@{$self->[4];}) { }
807 15 58 if $line->[3] >= $frame->[4]
808 15 58 if $line->[3] >= $frame->[6]
818 0 79 unless @$lines
819 47 32 unless defined $depth
821 35 44 if ($depth < 0)
836 103 28 if (not $frame->is_empty) { }
18 10 elsif (not $frame->[10] || $line->[9] || $line->[8]) { }
837 35 68 if $line->[9] and $self->_try_pack($frame, $line)
838 10 58 if $line->[8] and $self->_try_join($frame, $line)
850 0 68 if ($frame->[10] and $line->width > $self->[2][1])
854 59 9 unless ($line->[7])
857 41 18 if ($frame->[10])
858 15 26 unless $self->_check_fold_limits($frame)
862 42 26 unless $frame->[10]
878 5 40 if $prev->[3] >= $frame->[4]
879 4 41 if $prev->[3] >= $frame->[6]
880 35 10 if ($frame->[10])
881 0 35 unless ($self->_check_fold_limits($frame))
891 0 58 if $frame->[4] <= 1 or not $line->[9] or $frame->is_empty
895 0 35 unless $prev->[9] and $prev->[5] < $self->[2][4] and $self->_can_merge($prev, $line, $frame->[4])
900 1 34 unless $prev->[9]
907 2 43 if $frame->[6] <= 1 or not $line->[8] or $line->[5] >= $self->[2][10] or $frame->is_empty
912 0 10 unless $prev->[8] and $prev->[5] < $self->[2][10] and $self->_can_merge($prev, $line, $frame->[6])
922 1 75 if $frame->[7] > 1
923 4 71 if $frame->[8] > $frame->[5]
924 10 61 if $frame->[11] >= $self->[2][7]
930 0 47 unless (@{$self->[4];})
941 25 22 if (my $folded = $self->_try_fold($frame))
949 0 25 if not $frame->[10] or $frame->[7] != 1 or @{$frame->[3];} != 3
953 0 25 if $frame->[3][0][0] + $folded_len > $self->[2][1]
965 0 42 unless @$lines
969 23 19 if $keep_last
970 32 10 if (@$lines)
974 23 19 if $keep_last
1000 18 151 unless @$stack
1001 151 0 @$stack ? :
1006 84 0 $kind == 1 ? :
57 84 $kind == 2 ? :
1031 0 0 if $^S
1083 0 0 unless Getopt::Long::GetOptions("demo", \$opt{'demo'}, "verbose|v", \$opt{'verbose'}, "help|h", \$opt{'help'}, "input|i=s", \$opt{'input'}, "compact=s", \$opt{'compact'}, "indent=i", \$opt{'indent'}, "sort-keys!", \$opt{'sort_keys'}, "width=i", \$opt{'width'})
1107 0 0 if (defined $input) { }
1108 0 0 unless open my $fh, "<", $input
1111 0 0 unless close $fh
1137 0 0 if ($opt->{'help'})
1142 0 0 $opt->{'demo'} ? :
1147 0 0 if $verbose
1151 0 0 if $verbose