Branch Coverage

blib/lib/JSON/backportPP.pm
Criterion Covered Total %
branch 511 646 79.1


line true false branch
48 0 57 $] < 5.008 ? :
91 0 2 defined $_[1] ? :
2 0 if ($enable) { }
1 0 defined $_[1] ? :
1 0 if ($enable) { }
3 7 defined $_[1] ? :
7 3 if ($enable) { }
24679 25 defined $_[1] ? :
9335 15369 if ($enable) { }
0 1 defined $_[1] ? :
1 0 if ($enable) { }
0 2 defined $_[1] ? :
2 0 if ($enable) { }
2 1 defined $_[1] ? :
2 1 if ($enable) { }
0 0 defined $_[1] ? :
0 0 if ($enable) { }
4 12294 defined $_[1] ? :
12296 2 if ($enable) { }
5 11 defined $_[1] ? :
14 2 if ($enable) { }
4 9 defined $_[1] ? :
10 3 if ($enable) { }
0 1 defined $_[1] ? :
1 0 if ($enable) { }
0 0 $_[0]{'PROPS'}[14] ? :
0 0 $_[0]{'PROPS'}[13] ? :
4 3 $_[0]{'PROPS'}[9] ? :
5 2 $_[0]{'PROPS'}[7] ? :
0 0 $_[0]{'PROPS'}[15] ? :
0 0 $_[0]{'PROPS'}[19] ? :
0 0 $_[0]{'PROPS'}[18] ? :
0 0 $_[0]{'PROPS'}[17] ? :
4 3 $_[0]{'PROPS'}[0] ? :
4 3 $_[0]{'PROPS'}[4] ? :
4 3 $_[0]{'PROPS'}[10] ? :
0 0 $_[0]{'PROPS'}[16] ? :
4 3 $_[0]{'PROPS'}[3] ? :
4 3 $_[0]{'PROPS'}[1] ? :
0 0 $_[0]{'PROPS'}[12] ? :
4 3 $_[0]{'PROPS'}[11] ? :
4 3 $_[0]{'PROPS'}[8] ? :
4 3 $_[0]{'PROPS'}[6] ? :
4 3 $_[0]{'PROPS'}[5] ? :
12 304 $_[0]{'PROPS'}[2] ? :
8 4 defined $_[1] ? :
8 4 if ($enable) { }
2 6 defined $_[1] ? :
6 2 if ($enable) { }
0 0 defined $_[1] ? :
0 0 if ($enable) { }
2 18 defined $_[1] ? :
18 2 if ($enable) { }
2 21508 defined $_[1] ? :
21508 2 if ($enable) { }
9 4 defined $_[1] ? :
8 5 if ($enable) { }
8 4 defined $_[1] ? :
8 4 if ($enable) { }
7 18450 defined $_[1] ? :
18455 2 if ($enable) { }
178 5 0 defined $v ? :
180 3 2 if ($enable) { }
193 6 1 defined $_[1] ? :
203 4 1 defined $_[1] ? :
213 5 5 if (@_) { }
236 0 0 defined $_[0] ? :
237 0 0 if ($core_bools) { }
267 5 0 if (exists $self->{'true'} and exists $self->{'false'})
274 2 1 if (defined $_[1] and ref $_[1] eq 'CODE') { }
279 3 0 $_[0]{'cb_object'} || $_[0]{'cb_sk_object'} ? :
284 0 4 if (@_ == 1 or @_ > 3)
287 3 1 if (defined $_[2] and ref $_[2] eq 'CODE') { }
291 0 1 unless $_[0]{'cb_sk_object'}
0 1 unless %{{} unless $_[0]{'cb_sk_object'};}
293 4 0 $_[0]{'cb_object'} || $_[0]{'cb_sk_object'} ? :
298 0 0 if (not defined $_[1] or $_[1] > 15 or $_[1] < 0) { }
312 3 0 defined $_[1] ? :
368 268 24895 $canonical ? :
370 3 25160 if ($self->{'sort_by'})
373 1 1 $self->{'sort_by'} =~ /\D+/ ? :
1 2 ref $self->{'sort_by'} eq 'CODE' ? :
376 0 82 unless ref $obj or $props->[7]
381 7 25138 if $indent
391 348 25175 if ($type eq 'HASH') { }
25021 154 elsif ($type eq 'ARRAY') { }
67 87 elsif ($type) { }
398 47 20 if (&blessed($obj)) { }
400 28 19 if $obj->isa("JSON::PP::Boolean")
402 1 18 if ($allow_tags and $obj->can("FREEZE"))
406 0 1 if (@results and ref $results[0])
407 0 0 if (&refaddr($obj) eq &refaddr($results[0]))
417 9 9 if ($convert_blessed and $obj->can("TO_JSON"))
419 4 5 if (defined $result and ref $result)
420 1 3 if (&refaddr($obj) eq &refaddr($result))
431 3 6 if $bignum and _is_bignum($obj)
433 4 2 if ($allow_blessed)
434 0 4 if $as_nonblessed
454 1 347 if ++$depth > $max_depth
457 7 340 $indent ? :
458 5 342 $space_before ? :
5 342 $space_after ? :
464 36 710 ref $obj->{$k} ? :
468 7 338 if $indent
470 10 335 unless @res
479 1 25020 if ++$depth > $max_depth
482 2 25018 $indent ? :
485 316 25496 ref $v ? :
489 2 25004 if $indent
491 10 24996 unless @res
505 12487 13761 if utf8::is_utf8($value)
510 12933 828 unless length((my $dummy = "") & $value)
511 3 825 unless 0 + $value eq $value
512 825 0 if $value * 0 == 0
520 45 26296 unless defined $value
524 26248 48 if (not $type) { }
28 20 elsif (&blessed($value) and $value->isa('JSON::PP::Boolean')) { }
526 825 25423 if (do { _looks_like_number($value) })
535 14 14 $$value == 1 ? :
538 0 20 if ((overload::StrVal($value) =~ /=(\w+)/)[0])
542 7 13 if ($type eq "SCALAR" and defined $$value)
545 1 4 $self->{'PROPS'}[18] ? :
1 5 $$value eq '0' ? :
1 6 $$value eq '1' ? :
549 4 9 if ($self->{'PROPS'}[18]) { }
553 6 3 if ($type eq 'SCALAR' or $type eq 'REF') { }
581 1 26168 if $escape_slash
586 12297 13872 if ($ascii)
590 2 26167 if ($latin1)
594 12551 13618 if ($utf8)
604 0 0 if ($reftype eq 'HASH') { }
0 0 elsif ($reftype eq 'ARRAY') { }
623 222 125 defined $keysort ? :
659 2312298 1127735 $_ <= 65535 ? :
2824908 3440033 chr($_) =~ /[[:ascii:]]/ ? :
671 1 0 $_ <= 65535 ? :
21 1 $_ <= 255 ? :
687 1 2 unless $_[0]->isa("Math::BigInt")
703 57 912 if ($int =~ /[eE]/)
754 20 12390 unless defined $octets[3]
755 0 0 !$octets[2] ? :
2 0 $octets[2] ? :
0 2 !($octets[0] || $octets[1]) ? :
1 2 !$octets[0] && $octets[1] ? :
12387 3 $octets[0] && $octets[1] ? :
770 4 25280 if (not defined $text or ref $text)
781 12410 12870 if ($utf8) { }
783 3 12407 if ($encoding ne 'UTF-8' and $encoding ne 'unknown') { }
787 1 12406 unless utf8::downgrade($text, 1)
799 2 25277 if ($max_size > 1)
802 1 1 if $bytes > $max_size
810 2 25276 unless defined $ch
814 5 198 unless ($props->[7] or ref $result)
820 0 25194 if $len < $at
822 273 24921 defined $ch ? :
826 304 24890 if $want_offset
828 12 24878 if defined $ch
835 25085 36699880 if $at >= $len
842 0 53854 unless defined $ch
843 1390 52464 if $ch eq "{"
844 26119 26345 if $ch eq "["
845 1 26344 if $ch eq "("
846 25423 921 if $ch eq "\"" or $singlequote and $ch eq "'"
847 812 109 if $ch =~ /[0-9]/ or $ch eq "-"
859 27148 5 if ($ch eq "\"" or $singlequote and $ch eq "'")
864 27132 10688121 if ($ch eq $boundChar) { }
5302031 5386090 elsif ($ch eq '\\') { }
867 1 27131 if ($utf16)
871 24808 2323 if $is_utf8
877 153380 5148651 if (exists $escapes{$ch}) { }
5148647 4 elsif ($ch eq 'u') { }
885 0 20594588 unless $ch =~ /[0-9a-fA-F]/
890 1127738 4020909 if ($u =~ /^[dD][89abAB][0-9a-fA-F]{2}/) { }
1127737 2893172 elsif ($u =~ /^[dD][c-fC-F][0-9a-fA-F]{2}/) { }
895 1 1127736 unless (defined $utf16)
903 1 2893171 if (defined $utf16)
908 2893171 0 if (chr $u =~ /[[:^ascii:]]/) { }
919 4 0 unless ($loose)
928 3440100 1945990 if ($ch =~ /[[:^ascii:]]/)
929 3440095 5 if ($ch = is_valid_utf8($ch)) { }
940 5386085 0 unless ($loose)
941 4 5386081 if ($ch =~ /$invalid_char_re/)
942 4 0 if (not $relaxed or $ch ne "\t")
962 27684 137101 if ($ch eq '' or $ch =~ /\A[ \t\r\n]\z/) { }
0 137101 elsif ($relaxed and $ch eq '/') { }
967 0 0 if (defined $ch and $ch eq '/') { }
0 0 elsif (defined $ch and $ch eq '*') { }
973 0 0 if (defined $ch) { }
974 0 0 if ($ch eq '*') { }
975 0 0 if (defined next_chr() and $ch eq "/")
996 9 137092 if ($relaxed and $ch eq "#")
1013 3 26116 if ++$depth > $max_depth
1019 23 26093 if (defined $ch and $ch eq ']') { }
1030 3 26282 unless (defined $ch)
1034 25518 764 if ($ch eq "]")
1040 3 761 if ($ch ne ",")
1047 2 759 if ($relaxed and $ch eq "]")
1056 3 3 if defined $ch and $ch ne ""
1061 0 1 unless $allow_tags
1067 0 1 unless defined $tag
1068 0 1 if ref $tag
1072 0 1 if (not defined $ch or $ch ne ")")
1080 0 1 unless defined $val
1081 0 1 unless ref $val eq "ARRAY"
1083 0 1 unless (eval { do { $tag->can("THAW") } })
1084 0 0 if $@
1094 0 1390 if ++$depth > $max_depth
1099 9 1381 if (defined $ch and $ch eq '}') { }
1102 1 8 if ($F_HOOK)
1109 2 1730 $allow_barekey && $ch ne '"' && $ch ne q['] ? :
1112 3 1724 if (not defined $ch or $ch ne ":")
1121 2 1205 unless defined $ch
1123 847 358 if ($ch eq "}")
1126 8 839 if ($F_HOOK)
1132 5 353 if ($ch ne ",")
1139 1 352 if ($relaxed and $ch eq "}")
1142 0 1 if ($F_HOOK)
1152 5 3 if defined $ch and $ch ne ""
1170 21 88 if ($word eq 'true') { }
46 42 elsif ($word eq 'null') { }
18 24 elsif ($word eq 'fals') { }
1173 5 16 defined $alt_true ? :
1182 18 0 if (substr($text, $at, 1) eq "e")
1185 5 13 defined $alt_false ? :
1191 1 23 if $word =~ /^n/
1192 1 22 if $word =~ /^t/
1193 0 22 if $word =~ /^f/
1204 41 771 if ($ch eq "-")
1207 1 40 unless (defined $ch and $ch =~ /\d/)
1213 46 765 if ($ch eq 0)
1215 5 41 if ($peek =~ /^[0-9a-dfA-DF]/)
1227 49 757 if (defined $ch and $ch eq ".")
1232 1 48 if (not defined $ch && $ch =~ /\d/) { }
1244 58 737 if (defined $ch and $ch eq 'e' || $ch eq 'E')
1249 38 20 if (defined $ch and $ch eq '+' || $ch eq '-') { }
18 2 elsif (defined $ch and $ch =~ /\d/) { }
1252 2 36 if (not defined $ch or $ch =~ /\D/)
1272 70 731 if ($is_dec or $is_exp) { }
1273 1 69 if ($allow_bignum)
1278 1 730 if (length $v > $max_intsize)
1279 1 0 if ($allow_bignum) { }
1289 47 752 $is_dec ? :
1295 57 0 if $] >= "5.006" and require warnings
1312 9 3440091 if $limit > length $start_point
1322 3440095 1239102 if (utf8::decode($copy))
1347 100 1 defined $text ? :
1360 0 16 $chr_c eq '\\f' ? :
0 16 $chr_c eq '\\r' ? :
0 16 $chr_c eq '\\n' ? :
0 16 $chr_c eq '\\t' ? :
0 16 $chr_c eq '\\a' ? :
436 16 $chr_c =~ /[[:print:]]/ ? :
7 452 $chr_c eq '\\' ? :
1369 10 449 if (length $mess >= 20)
1375 30 71 unless (length $mess)
1380 6 95 $no_rep ? :
1390 4 1 if ($cb_sk_object and @ks == 1 and exists $$cb_sk_object{$ks[0]} and ref $$cb_sk_object{$ks[0]})
1392 1 3 if (@val == 0) { }
3 0 elsif (@val == 1) { }
1403 4 1 if $cb_object
1404 3 2 if (@val == 0) { }
2 0 elsif (@val == 1) { }
1451 0 57 unless (defined &utf8::is_utf8)
1462 0 57 if ($] < "5.008003")
1495 57 0 if $] >= "5.006"
0 304 if ($_[0]{'_incr_parser'}{'incr_pos'})
1515 0 57 if ($@) { }
1525 0 0 ref $_[0] ? :
1540 0 0 unless length ref $r
1545 0 0 length ref $$r ? :
0 0 exists $tmap{$t} ? :
1550 0 0 unless length ref $_[0]
1553 0 0 if (defined(my $pkg = &blessed($_[0]))) { }
1576 2 3 if (&blessed($_[0])) { }
1627 57 687 unless defined $self->{'incr_text'}
1629 402 342 if (defined $text)
1633 383 361 if (defined wantarray)
1639 393 1 unless ($self->{'incr_nest'} <= 0 and $self->{'incr_mode'} == 3)
1642 1 391 if ($max_size and $self->{'incr_pos'} > $max_size)
1645 83 308 unless ($self->{'incr_nest'} <= 0 and $self->{'incr_mode'} == 3)
1647 7 39 if ($self->{'incr_mode'} == 0 and $self->{'incr_pos'})
1655 301 8 unless ($coder->get_utf8)
1666 287 11 unless wantarray
1670 7 363 if (wantarray) { }
1674 287 76 defined $ret[0] ? :
1689 0 3084 unless defined $s
1692 335 2749 if ($mode == 0) { }
0 2749 elsif ($mode == 2) { }
9 2740 elsif ($mode == 4 or $mode == 5) { }
36 2704 elsif ($mode == 6) { }
399 2305 elsif ($mode == 7) { }
805 1500 elsif ($mode == 1) { }
1500 0 elsif ($mode == 3) { }
1695 0 594 unless defined $s
1696 328 266 if (ord $s > 32)
1697 6 322 if ($s eq '#') { }
1714 0 45 unless defined $s
1715 9 36 if ($s eq "\n")
1716 6 3 $self->{'incr_mode'} == 4 ? :
1723 1 0 if $p >= $len and $self->{'incr_nest'}
1726 105 35 if defined $s and $s =~ /[rueals]/
1732 0 35 unless $self->{'incr_nest'}
1735 3 2 if $p >= $len and $self->{'incr_nest'}
1738 93 389 if defined $s and $s =~ /[0-9eE.+\-]/
1744 18 378 unless $self->{'incr_nest'}
1749 0 84413 unless defined $s
1750 780 83633 if ($s eq '"') { }
508 83125 elsif ($s eq '\\') { }
1754 20 760 unless $self->{'incr_nest'}
1759 0 508 unless (defined substr($text, $p, 1))
1769 0 3614 if ($s eq "\000") { }
724 2890 elsif ($s =~ /^[\t\n\r ]$/) { }
36 2854 elsif ($s eq 't' or $s eq 'f' or $s eq 'n') { }
398 2456 elsif ($s =~ /^[0-9\-]$/) { }
783 1673 elsif ($s eq '"') { }
383 1290 elsif ($s eq '[' or $s eq '{') { }
369 921 elsif ($s eq ']' or $s eq '}') { }
3 918 elsif ($s eq '#') { }
1773 0 724 unless ($self->{'incr_nest'})
1788 1 382 if (++$self->{'incr_nest'} > $coder->get_max_depth)
1793 270 99 if (--$self->{'incr_nest'} <= 0)
1805 351 41 $p ? :
1810 0 0 if ($_[0]{'incr_pos'})