Branch Coverage

lib/Data/Pretty.pm
Criterion Covered Total %
branch 198 228 86.8


line true false branch
67 8 104 if @Data::Pretty::FILTERS
88 5 107 if (%Data::Pretty::require)
93 10 102 if (%Data::Pretty::refcnt)
97 10 17 if ($Data::Pretty::refcnt{$name})
111 150 10 defined $_->[1] ? :
115 13 99 if $paren and not $has_qw
117 13 99 if $paren and not $has_qw
119 14 98 if (%Data::Pretty::refcnt or %Data::Pretty::require)
125 0 112 unless defined wantarray
139 32 98 $paren ? :
140 130 0 defined $opts->{'use_qw'} ? :
143 12 118 if (@$values > 3)
152 37 279 if ($v eq '0' or $v =~ /^-?[1-9]\d{0,9}\z/) { }
266 13 elsif ($v =~ /^"([A-Za-z]{1,3}\d*)"\z/) { }
163 14 289 if $values->[$j] ne $v
166 9 31 if ($j - $i > 3)
174 1 129 if ($use_qw)
186 1 129 $use_qw ? :
187 1 129 if ($comment or @$values > $indent_lim and length $tmp > $Data::Pretty::LINEWIDTH || $tmp =~ /\n/) { }
188 0 1 if ($use_qw) { }
194 0 0 if (scalar @buf and length $Data::Pretty::INDENT . join(' ', @buf, $v) > $Data::Pretty::LINEWIDTH) { }
204 0 0 if scalar @buf
206 0 0 scalar @lines > 1 ? :
0 0 scalar @lines > 1 ? :
0 0 $comment ? :
215 1 0 $comment ? :
219 1 128 $use_qw ? :
229 2 7 if ($ref and @i and $i[0] eq "\$")
240 7 28 if ($i eq '*' or $i eq '$') { }
2 26 elsif ($i =~ s/^\*//) { }
247 24 2 unless $last_was_index++
251 7 34 if $ref
270 345 16 unless /[^\040-\176]/
278 5 11 unless ($Data::Pretty::SHOW_UTF8)
287 14 301 if (length $_[0] > 20)
290 4 10 if (/^(.)\1\1\1/s)
293 4 0 unless (/[^\Q$1\E]/)
300 2 8 if (length $_ < 16384 and /^(.{2,5}?)\1*\z/s)
310 3 5 if (length $_ > 40 and not /\\x\{/ and length $_ > length($_[0]) * 2)
316 1 1 if ($Data::Pretty::TRY_BASE64 and length $_[0] > $Data::Pretty::TRY_BASE64 and (defined &utf8::is_utf8 and not utf8::is_utf8($_[0])) and eval { do { require MIME::Base64 } })
332 2 78 if ($tied)
333 2 0 if (my $tied_ref = ref $tied) { }
346 140 1260 $ref ? :
355 26 1374 if ((my $i = rindex($strval, "=")) >= 0)
359 1400 0 if ((my $i = index($strval, '(0x')) >= 0) { }
366 0 1400 if ($] < "5.008" and $type eq "SCALAR")
367 0 0 if $ref eq "REF"
369 0 1400 if $Data::Pretty::DEBUG
374 11 1389 if (@Data::Pretty::FILTERS)
376 2 9 if $pclass
380 6 5 if (my $f = &$filter($ctx, $rval))
381 1 5 if (my $v = $f->{'object'})
391 1 5 if (defined(my $c = $f->{'bless'}))
394 1 5 if (my $c = $f->{'comment'})
397 1 5 if (defined(my $c = $f->{'dump'}))
401 2 4 if (my $h = $f->{'hide_keys'})
402 2 0 if (ref $h eq "ARRAY")
405 1 1 if $k eq $_[0]
413 2 9 if defined $out and not @bless
414 3 8 if (@bless)
416 0 3 if @bless
420 1385 15 unless ($dont_remember)
421 19 1366 if (my $s = $Data::Pretty::seen{$id})
426 0 19 if $Data::Pretty::DEBUG
427 15 4 unless $sname eq $name
430 1 3 if @$idx and $idx->[-1] eq "\$"
436 27 1354 if ($class)
441 2 1379 if (defined $out) { }
1246 133 elsif ($type eq 'SCALAR' or $type eq 'REF' or $type eq 'REGEXP') { }
40 93 elsif ($type eq 'GLOB') { }
18 75 elsif ($type eq 'ARRAY') { }
62 13 elsif ($type eq 'HASH') { }
2 11 elsif ($type eq 'CODE') { }
11 0 elsif ($type eq 'VSTRING') { }
446 32 1214 if ($ref) { }
448 9 23 if ($class and $class eq 'Regexp') { }
452 9 0 if ($v =~ /^\(\?\^?([msix-]*):([\x00-\xFF]*)\)\z/)
460 4 5 if ($sep_count)
465 3 7 if ($c < $sep_count)
468 3 0 if $sep_count == 0
478 11 12 if $type eq "SCALAR"
487 4 19 $class ? :
491 3 1211 if (not defined $$rval) { }
4 1207 elsif ($$rval =~ /^-?(?:nan|inf)/i) { }
896 311 elsif (do { BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x05"} $$rval + 0 eq $$rval }) { }
503 1 1213 if ($class and not @$idx)
514 6 34 if ($ref) { }
525 4 2 if ($out =~ /^\\\*Symbol::/)
535 61 41 unless defined $gval
536 29 12 if $k eq "SCALAR" and not defined $$gval
592 1 61 if ($hide_keys)
597 43 7 unless /^[-+]?(?:0|[1-9]\d*)(?:\.\d+)?\z/
600 43 19 if ($text_keys) { }
610 874 33 if $key =~ /^-?[a-zA-Z_]\w*\z/
611 4 29 if $key =~ /^-?[1-9]\d{0,8}\z/
612 3 26 if $key =~ /^-?\d{1,9}\.\d+\z/
622 26 881 if $need_quotes->{$key}
623 109 798 if length $key > $kstat_max
638 47 860 if ((my $i = index(overload::StrVal($$val), "(0x")) >= 0)
642 4 22 if (defined $this_type and $this_type eq "HASH" and scalar keys %{$$rval{$key};})
651 1 39 if (length $tmp > $Data::Pretty::LINEWIDTH or $tmp =~ /\n/ or $tied or $need_breakdown)
655 1 61 if $tied
659 0 907 $klen_pad ? :
661 854 53 $nl ? :
662 0 907 if $nl and $klen_pad > length $key
665 39 23 unless $nl
670 1 1 if ($Data::Pretty::CODE_DEPARSE and eval { do { require B::Deparse } }) { }
689 3 8 $ref ? :
696 14 1367 if ($class and $ref)
699 1 1380 if ($comment)
701 1 0 unless $comment =~ /\n\z/
717 12 362 if (not defined $v or ref $v or substr(overload::StrVal(\$v), 0, 7) eq "VSTRING" or not ref $v and $v =~ /[\,\#[:blank:]\h\v]/)
726 63 299 if $v =~ /^[-+]?(?:0|[1-9]\d*)(?:\.\d+)?\z/
729 118 12 if $only_numbers == scalar @$rval or scalar @$rval == 1