Branch Coverage

lib/BATsh/CMD.pm
Criterion Covered Total %
branch 102 282 36.1


line true false branch
33 0 5 if ($] < "5.006" and not defined &warnings::import)
35 0 5 if $INC[-1] eq "."
70 1 39 if ($l =~ /\A:([A-Za-z_][A-Za-z0-9_]*)\s*\z/)
84 1 33 if ($_GOTO_LABEL ne "")
87 1 0 if (exists $labels{$lbl}) { }
0 0 elsif ($lbl eq 'EOF') { }
100 0 33 if (defined $rc and $rc eq "__EXIT__")
112 34 17 unless defined $pre_expanded
118 1 50 if ($line =~ s/\A\@//)
120 0 51 if $line =~ /\A\s*\z/
121 0 51 if $line =~ /\A::/
122 0 51 if $line =~ /\AREM(?:\s|\z)/i
123 0 51 if $line =~ /\A:[A-Za-z_]/
124 0 51 if $line =~ /\A\s*\)\s*(?:ELSE\s*.*)??\s*\z/i
125 0 51 if $line =~ /\A#/
127 39 12 unless ($pre_expanded)
129 3 36 if ($line =~ /\AFOR\s/i) { }
131 3 0 if ($line =~ m[\A(FOR\s+(?:/[A-Za-z]\s+)?%%[A-Za-z]\s+(?:/[A-Za-z]\s+)?IN\s*\([^)]*\)\s+DO\s+)(.*)\z]i) { }
166 0 51 unless defined $cmd and $cmd ne ""
170 3 48 if ($CMD eq "ECHO")
173 0 48 if ($CMD eq "\@ECHO")
177 38 10 if ($CMD eq "SET")
180 6 4 if ($CMD eq "IF")
183 3 1 if ($CMD eq "FOR")
186 1 0 if ($CMD eq "GOTO")
193 0 0 if ($CMD eq "CALL")
196 0 0 if ($CMD eq "SETLOCAL")
200 0 0 if ($CMD eq "ENDLOCAL")
204 0 0 if ($CMD eq "CD" or $CMD eq "CHDIR")
207 0 0 if ($CMD eq "DIR")
210 0 0 if ($CMD eq "COPY")
213 0 0 if ($CMD eq "DEL" or $CMD eq "ERASE")
216 0 0 if ($CMD eq "MOVE")
219 0 0 if ($CMD eq "MKDIR" or $CMD eq "MD")
222 0 0 if ($CMD eq "RMDIR" or $CMD eq "RD")
225 0 0 if ($CMD eq "REN" or $CMD eq "RENAME")
228 0 0 if ($CMD eq "TYPE")
231 0 0 if ($CMD eq "PAUSE")
238 0 0 if ($CMD eq "EXIT")
240 0 0 $rest =~ s[/B\s*][]i ? :
242 0 0 $rest =~ /\A\d+\z/ ? :
245 0 0 if ($CMD eq "CLS")
249 0 0 if ($CMD eq "TITLE")
254 0 0 if ($CMD eq "VER")
258 0 0 if ($CMD eq "PUSHD")
263 0 0 if ($CMD eq "POPD")
264 0 0 if (defined $opts_ref->{'_pushd_stack'} and @{$opts_ref->{'_pushd_stack'};})
282 1 2 if ($rest =~ /\AOFF\s*\z/i)
283 0 2 if ($rest =~ /\AON\s*\z/i)
286 0 2 if ($rest =~ /\A\.\s*\z/)
289 0 2 if ($rest =~ /\A\s*\z/)
290 0 0 $ECHO_ON ? :
307 10 28 if ($rest =~ s[\A/A\s*][]i)
309 10 0 if ($rest =~ /\A\s*([A-Za-z_][A-Za-z0-9_]*)\s*=(.*)\z/) { }
323 0 28 if ($rest =~ /\A\s*\z/)
331 28 0 if ($rest =~ /\A([A-Za-z_][A-Za-z0-9_]*)\s*=(.*)/)
338 0 0 if ($rest =~ /\A([A-Za-z_][A-Za-z0-9_]*)\s*\z/)
341 0 0 if (index(uc $k, uc $prefix) == 0)
359 0 0 defined $v && $v =~ /^\d+$/ ? :
364 10 0 if ($expr =~ m[\A[\d\s\+\-\*/\%\(\)]+\z])
366 10 0 defined $result ? :
381 1 5 if ($rest =~ s/\ANOT\s+//i)
386 0 6 if ($rest =~ s/\AERRORLEVEL\s+(\d+)\s*//i) { }
1 5 elsif ($rest =~ s/\AEXIST\s+(\S+)\s*//i) { }
1 4 elsif ($rest =~ s/\ADEFINED\s+([A-Za-z_][A-Za-z0-9_]*)\s*//i) { }
4 0 elsif ($rest =~ s/\A("?[^"]*"?)\s*==\s*("?[^"]*"?)\s*//) { }
0 0 elsif ($rest =~ s[\A/I\s+("?[^"]*"?)\s*==\s*("?[^"]*"?)\s*][]i) { }
387 0 0 $ERRORLEVEL >= int $1 ? :
391 1 0 -e $1 ? :
395 1 0 'BATsh::Env'->exists_var($1) ? :
402 1 3 $a eq $b ? :
409 0 0 lc $a eq lc $b ? :
412 1 5 if $negate
417 4 2 if ($condition) { }
1 1 elsif (defined $else_body) { }
434 1 5 if ($rest =~ s/\A\(//) { }
440 0 5 if ($rest =~ s/\s+ELSE\s+(.+)\z//i)
453 0 2 if defined $first_content and $first_content =~ /\S/
463 1 3 if ($depth == 1 and $ls =~ /\A\)\s*ELSE\s*\(\s*\z/i)
465 1 0 if (defined $else_ref)
470 0 3 if ($depth == 1 and $ls =~ /\A\)\s*ELSE\s+(.+)\z/i)
471 0 0 if (defined $else_ref)
478 0 43 if ($ch eq '"') { }
43 0 elsif (not $in_q) { }
480 0 43 if $ch eq "("
481 1 42 if $ch eq ")"
486 1 2 if ($depth <= 0)
489 0 1 if $l =~ /\S/
501 0 5 unless defined $body and $body =~ /\S/
502 5 0 unless defined $expanded
510 0 5 if ($ls =~ /\A:([A-Za-z_][A-Za-z0-9_]*)\s*\z/)
518 0 5 if defined $rc and $rc eq "__EXIT__"
519 0 5 if ($_GOTO_LABEL ne "")
522 0 0 if (exists $sub_labels{$lbl}) { }
541 1 2 if ($line =~ /\AFOR\s+(?:%%|\x00FOR_)([A-Za-z])(?:\x00)?\s+IN\s*\(([^)]*)\)\s+DO\s+(.*)/i)
548 0 3 if $item eq ""
549 0 3 if ($item =~ /[*?]/) { }
551 0 0 @glob ? :
565 0 1 if ($probe =~ /\A\s*\(\s*\z/)
571 0 3 if (defined $for_in_paren_body) { }
590 0 3 if $_GOTO_LABEL ne ""
596 2 0 if ($line =~ m[\AFOR\s+/L\s+(?:%%|\x00FOR_)([A-Za-z])(?:\x00)?\s+IN\s*\(([^)]*)\)\s+DO\s+(.*)]i)
599 2 0 defined $start ? :
600 2 0 defined $step ? :
601 2 0 defined $end ? :
602 0 2 if $step == 0
611 0 2 if ($probe =~ /\A\s*\(\s*\z/)
618 0 9 if (defined $paren_body_l) { }
636 0 9 if $_GOTO_LABEL ne ""
654 0 0 if ($rest =~ /\A:([A-Za-z_][A-Za-z0-9_]*)(.*)/i)
660 0 0 defined $args[$n - 1] ? :
663 0 0 if (defined $opts_ref->{'_batsh'})
670 0 0 if ($rest =~ /(\S+\.batsh)(.*)/i)
672 0 0 if (defined $opts_ref->{'_batsh'})
689 0 0 if ($rest eq "" or $rest eq "/D")
695 0 0 unless (chdir $rest)
712 0 0 $rest eq '' ? :
716 0 0 if $target eq ""
717 0 0 unless (-e $target)
723 0 0 if (-d $target) { }
724 0 0 unless (opendir DH, $target)
729 0 0 if $e eq "." or $e eq ".."
731 0 0 if (-d $full) { }
756 0 0 unless (defined $src and defined $dst)
760 0 0 unless (File::Copy::copy($src, $dst))
779 0 0 unless @files
782 0 0 if (unlink $f) { }
797 0 0 unless (defined $src and defined $dst)
801 0 0 unless (File::Copy::move($src, $dst))
818 0 0 if (-d $rest)
834 0 0 $rest =~ s[\s*/S\s*][]i ? :
837 0 0 if ($recurse) { }
841 0 0 unless (rmdir $rest)
858 0 0 unless (defined $src and defined $dst)
862 0 0 unless (rename $src, $dst)
879 0 0 unless (open TFH, $rest)
895 0 0 unless defined $rest
897 0 0 $rest ne '' ? :
900 0 0 $rc == 0 ? :
909 51 0 if ($line =~ /\A(\S+)\s*(.*)\z/s)
933 0 5 if ($@)