Branch Coverage

bin/jq-lite
Criterion Covered Total %
branch 183 290 63.1


line true false branch
69 0 46 if not defined $query or $query eq ""
76 8 344 if (defined $string)
77 2 6 if ($escape)
82 2 4 if ($char eq "\\")
87 3 1 if ($char eq $string)
93 3 341 if ($char eq "'" or $char eq "\"")
98 12 322 if ($char eq "(" or $char eq "[" or $char eq "{")
103 11 304 if ($char eq ")" or $char eq "]" or $char eq "}")
110 0 18 if (not defined $open or $open ne $pairs{$char})
116 1 45 if (defined $string or @stack)
121 1 44 if (grep {not defined $_ && $_ =~ /\S/;} @pipeline_parts)
127 1 54 if (grep {not defined $_ && $_ =~ /\S/;} @comma_parts)
136 2 2 unless defined $value
138 1 1 if (ref $value eq "JSON::PP::Boolean")
139 0 1 $value ? :
196 9 1 if ($msg =~ /^\[(?:COMPILE|RUNTIME|INPUT|USAGE)\]/)
197 0 9 if ($orig_warn) { }
227 0 5 if not defined $var_name or $var_name eq ""
228 0 5 unless ($var_name =~ /^[A-Za-z_]\w*$/)
231 0 5 unless @ARGV
233 0 5 unless defined $file_path
235 1 4 if @ARGV == 0 and $file_path =~ /^\./
241 0 3 if not defined $var_name or $var_name eq ""
242 1 2 unless ($var_name =~ /^[A-Za-z_]\w*$/)
245 1 1 unless @ARGV
247 0 1 unless defined $value
252 0 7 if not defined $var_name or $var_name eq ""
253 1 6 unless ($var_name =~ /^[A-Za-z_]\w*$/)
256 1 5 unless @ARGV
258 0 5 unless defined $value_text
261 2 3 if (my $err = $@)
270 0 3 if not defined $var_name or $var_name eq ""
271 0 3 unless ($var_name =~ /^[A-Za-z_]\w*$/)
274 0 3 unless @ARGV
276 0 3 unless defined $file_path
278 1 2 unless my $fh = "IO::File"->new($file_path, "r")
282 0 2 unless defined $json_text
286 1 1 if (my $err = $@)
295 0 2 if not defined $var_name or $var_name eq ""
296 0 2 unless ($var_name =~ /^[A-Za-z_]\w*$/)
299 0 2 unless @ARGV
301 0 2 unless defined $file_path
304 1 1 unless (open my $fh, "<", $file_path)
310 0 1 unless defined $content
317 1 53 unless ($getopt_ok)
318 1 0 @getopt_errors ? :
323 0 53 if ($help_functions)
328 0 53 if ($want_help)
333 0 53 if ($want_version)
341 0 63 unless defined fileno STDOUT
343 1 62 if (not close STDOUT)
347 1 0 if $!{'EPIPE'} or $!{'EINVAL'}
371 3 50 if (@query_files)
372 0 3 if @query_files > 1
375 2 1 if (defined $file and $file eq "-")
376 1 0 unless ($null_input or @ARGV)
381 1 1 if (defined $file and $file eq '-') { }
384 0 1 unless defined $query
387 0 1 unless my $fh = "IO::File"->new($file, "r")
395 4 48 if (@ARGV == 0) { }
35 13 elsif (@ARGV == 1) { }
13 0 elsif (@ARGV == 2) { }
396 3 1 unless (defined $query)
397 1 2 if ($slurpfile_probably_missing_file)
401 2 0 if ($raw_input)
402 1 1 $slurp_input ? :
408 0 0 if ($null_input) { }
411 0 0 if ($non_help_option_used)
423 0 35 if (not $null_input and -f $ARGV[0] and not defined $query) { }
34 1 elsif (not defined $query) { }
433 0 1 if ($null_input)
436 1 0 if (-f $f) { }
445 0 13 if $null_input
447 13 0 if (not defined $query) { }
454 12 1 if (-f $f) { }
466 0 48 if ($decoder_choice) { }
467 0 0 if ($decoder_choice eq 'JSON::MaybeXS') { }
0 0 elsif ($decoder_choice eq 'Cpanel::JSON::XS') { }
0 0 elsif ($decoder_choice eq 'JSON::XS') { }
0 0 elsif ($decoder_choice eq 'JSON::PP') { }
492 48 0 if (eval { do { require JSON::MaybeXS; 1 } }) { }
0 0 elsif (eval { do { require Cpanel::JSON::XS; 1 } }) { }
0 0 elsif (eval { do { require JSON::XS; 1 } }) { }
511 0 48 if $decoder_debug
514 4 44 if (@slurpfiles)
518 0 4 if not defined $var_name or $var_name eq ""
519 0 4 unless ($var_name =~ /^[A-Za-z_]\w*$/)
523 0 4 if not defined $file_path or $file_path eq ""
525 1 3 unless my $fh = "IO::File"->new($file_path, "r")
529 0 3 unless defined $json_text
533 1 2 if ($@)
542 46 0 if (defined $query)
549 8 35 if ($null_input) { }
13 22 elsif (defined $filename) { }
550 1 7 $slurp_input ? :
553 0 13 unless open my $fh, "<", $filename
557 1 12 if not $force_yaml and $filename =~ /\.ya?ml\z/i
561 0 22 if (-t STDIN)
568 4 39 if $raw_input
569 1 42 if $force_yaml and not $null_input
571 2 41 if ($use_yaml)
573 0 2 if $decoder_debug and $yaml_module
579 4 39 if ($raw_input)
584 4 39 if ($raw_input)
588 2 2 if ($slurp_input) { }
593 2 0 if (@raw_lines and $raw_lines[-1] eq "" and $text =~ /\r?\n\z/)
599 2 37 if (not $raw_input and $slurp_input and not $null_input)
601 0 0 if (not $decoded and $@)
608 39 4 unless ($raw_input)
609 1 38 unless eval { do { JQ::Lite::Util::_decode_json($json_text); 1 } }
615 0 2 unless defined $text
617 2 0 unless $yaml_loader
620 0 2 if (my $err = $@)
626 0 2 if (not @docs) { }
2 0 elsif (@docs == 1) { }
640 0 2 if (eval { do { require YAML::XS; 1 } }) { }
0 2 elsif (eval { do { require YAML::PP; 1 } }) { }
654 0 2 unless (defined $docs)
672 0 5 unless defined $text
683 4 7 if $offset >= $length
711 19 20 unless $compact_output
715 2 2087 if (not defined $r) { }
0 2087 elsif ($raw_output and not ref $r) { }
723 0 2087 if $color_output
725 23 2063 unless $json =~ /\n\z/
731 0 42 if ($raw_input and not defined $query)
732 0 0 $slurp_input ? :
738 0 42 unless (defined $query)
754 0 0 unless ($ok and @last_results)
756 0 0 if ($data)
762 0 0 if (@last_results) { }
776 0 0 if $ord == 27
778 0 0 if ($ord == 127 or $char eq "\cH") { }
779 0 0 if length $input
792 0 0 if ($ok and @results)
796 0 0 if (not $ok) { }
0 0 elsif (not @results) { }
802 0 0 if (@last_results) { }
806 0 0 unless (eval { do { print_results(@last_results); 1 } })
825 2 40 if ($raw_input and not $slurp_input) { }
830 0 5002 if ($@)
840 3 37 if ($@)
848 4 35 if ($exit_status)
849 3 1 @results ? :
850 1 3 _is_truthy($last) ? :