Branch Coverage

lib/BATsh.pm
Criterion Covered Total %
branch 150 222 67.5


line true false branch
17 0 15 if ($] < "5.006" and not defined &warnings::import)
19 0 15 if $INC[-1] eq "."
81 0 21 unless (-f $file)
83 0 21 unless open SRCFH, $file
88 21 0 defined $args{'args'} ? :
91 21 0 if defined &BATsh::SH::fire_exit_trap
97 0 145 unless defined $source
101 145 0 if defined &BATsh::SH::fire_exit_trap
109 0 0 if defined &BATsh::SH::fire_exit_trap
115 0 166 unless %BATsh::Env::STORE
127 25 0 defined $script ? :
128 3 22 if ($abs_script ne "" and not "File::Spec"->file_name_is_absolute($abs_script))
129 3 0 defined &Cwd::cwd ? :
134 11 214 defined $args[$n - 1] ? :
144 484 0 unless (defined $token)
145 252 232 if ($token =~ m[\A[A-Z0-9_\-\\/\.:\@%]+\z] and $token =~ /[A-Z]/)
158 18 475 if $s =~ /\A\s*\z/
159 5 470 if $s =~ /\A\s*(?:::|\@?REM(?:\s|\z))/i
160 1 469 if $s =~ /\A\s*#(?!!)/
162 469 0 $t =~ /\A(\S+)/ ? :
173 56 3782 if ($ch eq '"') { }
3739 43 elsif (not $in_q) { }
175 6 3733 if $ch eq "("
176 6 3733 if $ch eq ")"
207 0 230 unless defined $line
210 48 182 unless ($line =~ /[\s;&|(){}'"`]/)
212 3 45 if exists $_SH_OPEN{$l}
213 16 29 if exists $_SH_CLOSE{$l}
224 16 1287 if ($c eq "'")
229 39 1248 if ($c eq "\"")
232 0 252 if (substr($line, $i, 1) eq "\\")
237 1 1247 if ($c eq "`")
242 6 23 if ($c eq "\$" and $i + 1 < $n and substr($line, $i + 1, 1) eq "(")
247 6 139 if $ch eq "("
248 12 133 if $ch eq ")"
253 533 708 if ($c =~ /\s/)
254 28 633 if ($c eq ";" or $c eq "&" or $c eq "|")
255 28 605 if ($c eq "(")
256 31 574 if ($c eq ")")
257 6 3 if $cmdpos
9 565 if ($c eq "{")
258 6 3 if $cmdpos
9 556 if ($c eq "}")
264 426 2423 if $wc =~ /[\s;&|(){}'"`]/
267 270 286 if ($cmdpos) { }
269 24 246 if (exists $_SH_OPEN{$lw}) { }
11 235 elsif (exists $_SH_CLOSE{$lw}) { }
273 25 245 $lw eq 'do' || $lw eq 'then' || $lw eq 'else' || $lw eq 'elif' ? :
325 63 574 if ($s =~ /\A:([A-Za-z_][A-Za-z0-9_]*)\s*\z/) { }
25 549 elsif ($cur ne '' and $s =~ /\A(?:RET|RETURN)\s*\z/i) { }
0 999 elsif ($cur ne '' and $s =~ /\A:([A-Za-z_][A-Za-z0-9_]*)\s*\z/) { }
342 63 574 if ($s =~ /\A:([A-Za-z_][A-Za-z0-9_]*)\s*\z/)
344 15 48 if ($in_sub ne "")
351 25 23 if ($is_sub_label{$lbl})
360 86 488 if ($in_sub ne "")
361 25 61 if ($s =~ /\A(?:RET|RETURN)\s*\z/i) { }
372 0 195 if $in_sub ne ""
383 0 29 unless exists $_SUBROUTINES{$label}
397 314 295 exists $BATsh::Env::STORE{$k} ? :
407 44 217 defined $args[$n - 1] ? :
416 44 217 if ($n <= scalar @args) { }
428 314 295 if (defined $saved{$k}) { }
431 0 29 unless $ok
437 0 0 unless -f $file
439 0 0 unless open SFHH, $file
462 4 239 if ($s =~ /\ASETLOCAL(?:\s+(.*))?\z/i)
463 0 4 defined $1 ? :
469 4 235 if ($s =~ /\AENDLOCAL\s*\z/i)
482 101 0 if @batch
487 0 101 unless @{$lines_ref;}
503 0 268 if ($s =~ /\A(?:source|\.)\s+(\S+\.batsh)/)
505 0 0 if @batch
507 0 0 if $@
512 107 0 if @batch
517 0 107 unless @{$lines_ref;}
546 13 498 if (defined $pending_hd_delim)
553 29 482 if (defined $hd_delim)
556 2 27 if $hd_dash
557 12 17 if $probe eq $hd_delim
565 223 259 if ($mode eq "SH")
567 13 210 if (@hd)
573 18 464 if ($mode eq "EMPTY" or $mode eq "COMMENT")
583 18 0 if $cur_mode ne ""
587 195 269 if ($cur_mode eq '') { }
254 15 elsif ($mode eq $cur_mode) { }
590 94 101 $mode eq 'CMD' ? :
594 140 114 $mode eq 'CMD' ? :
595 0 254 if $depth < 0
598 2 13 if ($depth > 0) { }
600 2 0 $cur_mode eq 'CMD' ? :
601 0 2 if $depth < 0
604 13 0 if @pending
606 7 6 $mode eq 'CMD' ? :
610 195 0 if @pending
615 0 208 unless @lines
616 101 107 if ($mode eq 'CMD') { }
633 0 0 $depth > 0 || defined $hd_delim ? :
635 0 0 unless defined $line
639 0 0 if (defined $pending_hd_delim)
644 0 0 if (defined $hd_delim)
647 0 0 if $hd_dash
648 0 0 if $probe eq $hd_delim
649 0 0 if (not defined $hd_delim and $depth == 0)
656 0 0 if ($line =~ /\A\s*(?:EXIT|exit)\s*\z/)
657 0 0 if $depth == 0 and $line =~ /\A\s*\z/
660 0 0 if $depth == 0 and $cur_mode eq ""
662 0 0 if ($cur_mode eq "SH")
664 0 0 if (@hd)
666 0 0 $cur_mode eq 'CMD' ? :
667 0 0 if $depth < 0
668 0 0 if ($depth == 0 and not defined $pending_hd_delim)