Branch Coverage

lib/BATsh.pm
Criterion Covered Total %
branch 90 152 59.2


line true false branch
19 0 7 if ($] < "5.006" and not defined &warnings::import)
21 0 7 if $INC[-1] eq "."
83 0 0 unless (-f $file)
85 0 0 unless open SRCFH, $file
90 0 0 defined $args{'args'} ? :
98 0 64 unless defined $source
114 0 64 unless %BATsh::Env::STORE
126 4 0 defined $script ? :
127 3 1 if ($abs_script ne "" and not "File::Spec"->file_name_is_absolute($abs_script))
128 3 0 defined &Cwd::cwd ? :
133 6 30 defined $args[$n - 1] ? :
143 193 0 unless (defined $token)
144 62 131 if ($token =~ m[\A[A-Z0-9_\-\\/\.:\@%]+\z] and $token =~ /[A-Z]/)
157 11 182 if $s =~ /\A\s*\z/
158 3 179 if $s =~ /\A\s*(?:::|\@?REM(?:\s|\z))/i
159 1 178 if $s =~ /\A\s*#(?!!)/
161 178 0 $t =~ /\A(\S+)/ ? :
172 18 1124 if ($ch eq '"') { }
1112 12 elsif (not $in_q) { }
174 6 1106 if $ch eq "("
175 6 1106 if $ch eq ")"
190 15 114 if exists $_SH_OPEN{$l} or $first eq "{"
191 20 94 if exists $_SH_CLOSE{$l} or $first eq "}"
210 2 183 if ($s =~ /\A:([A-Za-z_][A-Za-z0-9_]*)\s*\z/) { }
1 182 elsif ($cur ne '' and $s =~ /\A(?:RET|RETURN)\s*\z/i) { }
0 362 elsif ($cur ne '' and $s =~ /\A:([A-Za-z_][A-Za-z0-9_]*)\s*\z/) { }
227 2 183 if ($s =~ /\A:([A-Za-z_][A-Za-z0-9_]*)\s*\z/)
229 1 1 if ($is_sub_label{$lbl}) { }
231 0 1 if $in_sub ne ""
237 1 0 if $in_sub eq ""
238 0 1 if $in_sub ne ""
242 2 181 if ($in_sub ne "")
243 1 1 if ($s =~ /\A(?:RET|RETURN)\s*\z/i) { }
251 0 65 if $in_sub ne ""
262 0 1 unless exists $_SUBROUTINES{$label}
273 0 0 unless -f $file
275 0 0 unless open SFHH, $file
298 4 49 if ($s =~ /\ASETLOCAL(?:\s+(.*))?\z/i)
299 0 4 defined $1 ? :
305 4 45 if ($s =~ /\AENDLOCAL\s*\z/i)
310 1 44 if ($s =~ /\ACALL\s+:([A-Za-z_][A-Za-z0-9_]*)(.*)/i)
312 0 1 if @batch
316 0 1 if $@
319 0 44 if ($s =~ /\ACALL\s+(\S+\.batsh)(.*)/i)
321 0 0 if @batch
323 0 0 if $@
328 29 1 if @batch
333 0 29 unless @{$lines_ref;}
349 0 129 if ($s =~ /\A(?:source|\.)\s+(\S+\.batsh)/)
351 0 0 if @batch
353 0 0 if $@
358 45 0 if @batch
363 0 45 unless @{$lines_ref;}
382 9 173 if ($mode eq "EMPTY" or $mode eq "COMMENT")
383 9 0 if $cur_mode ne ""
387 65 108 if ($cur_mode eq '') { }
96 12 elsif ($mode eq $cur_mode) { }
390 26 39 $mode eq 'CMD' ? :
394 21 75 $mode eq 'CMD' ? :
395 5 91 if $depth < 0
398 2 10 if ($depth > 0) { }
400 2 0 $cur_mode eq 'CMD' ? :
401 0 2 if $depth < 0
404 10 0 if @pending
406 4 6 $mode eq 'CMD' ? :
410 65 0 if @pending
415 0 75 unless @lines
416 30 45 if ($mode eq 'CMD') { }
431 0 0 $depth > 0 ? :
433 0 0 unless defined $line
435 0 0 if ($line =~ /\A\s*(?:EXIT|exit)\s*\z/)
436 0 0 if $depth == 0 and $line =~ /\A\s*\z/
439 0 0 if $depth == 0 and $cur_mode eq ""
440 0 0 $cur_mode eq 'CMD' ? :
441 0 0 if $depth < 0
442 0 0 if ($depth == 0)