From: Alfred Agrell floating@muncher.se
if errorlevel is a >= comparison, so if errorlevel 0 always succeeds, making the test meaningless. --- programs/cmd/tests/test_builtins.cmd | 24 ++----- programs/cmd/tests/test_builtins.cmd.exp | 88 ++++++++++++------------ 2 files changed, 48 insertions(+), 64 deletions(-)
diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index 7db955f634d..39ce652341b 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -2598,11 +2598,7 @@ echo ------------ Testing del ------------ echo abc > file echo deleting 'file' del file -if errorlevel 0 ( - echo errorlevel is 0, good -) else ( - echo unexpected errorlevel, got %errorlevel% -) +echo %errorlevel% if not exist file ( echo successfully deleted 'file' ) else ( @@ -2610,11 +2606,7 @@ if not exist file ( ) echo attempting to delete 'file', even though it is not present del file -if errorlevel 0 ( - echo errorlevel is 0, good -) else ( - echo unexpected errorlevel, got %errorlevel% -) +echo %errorlevel%
echo ------------ Testing del /a ------------ del /f/q *.test > nul @@ -3418,11 +3410,7 @@ goto :eof
:CheckOutputExist find /i "%1" test1.txt >nul 2>&1 -if errorlevel 0 ( - echo Passed: Found expected %1 in COPY output -) else ( - echo Failed: Did not find expected %1 in COPY output -) +echo line %1 errorlevel %errorlevel% expected 0 shift if not "%1"=="" goto :CheckOutputExist del /q test1.txt >nul 2>&1 @@ -3430,11 +3418,7 @@ goto :eof
:CheckOutputNotExist find /i "%1" test1.txt >nul 2>&1 -if errorlevel 1 ( - echo Passed: Did not find %1 in COPY output -) else ( - echo Failed: Unexpectedly found %1 in COPY output -) +echo line %1 errorlevel %errorlevel% expected 1 shift if not "%1"=="" goto :CheckOutputNotExist del /q test1.txt >nul 2>&1 diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index de28e463e14..8c33121f04f 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -1664,10 +1664,10 @@ a a b c ------------ Testing del ------------ deleting 'file' -errorlevel is 0, good +0 successfully deleted 'file' attempting to delete 'file', even though it is not present -errorlevel is 0, good +@todo_wine@0 ------------ Testing del /a ------------ not-r.test not found after delete, good r.test found before delete, good @@ -1936,33 +1936,33 @@ file correctly deleted --- a batch file can alter itself bar ---------- Testing copy -Passed: Did not find file1 in COPY output +line file1 errorlevel 1 expected 1 Passed: Found expected dummy.file -Passed: Did not find file1 in COPY output +line file1 errorlevel 1 expected 1 Passed: Found expected dir1\file1 -Passed: Did not find file1 in COPY output +line file1 errorlevel 1 expected 1 Passed: Found expected dir1\file1 -Passed: Did not find file1 in COPY output +line file1 errorlevel 1 expected 1 Passed: Found expected dir1\file99 -Passed: Did not find file1 in COPY output +line file1 errorlevel 1 expected 1 Passed: Found expected file1 Passed: Did not find dir2 Passed: Did not find dir2\file1 -Passed: Found expected file1 in COPY output -Passed: Found expected file2 in COPY output -Passed: Found expected file3 in COPY output +line file1 errorlevel 0 expected 0 +line file2 errorlevel 0 expected 0 +line file3 errorlevel 0 expected 0 Passed: Found expected dir1\file1 Passed: Found expected dir1\file2 Passed: Found expected dir1\file3 -Passed: Found expected file1 in COPY output -Passed: Found expected file2 in COPY output -Passed: Found expected file3 in COPY output +line file1 errorlevel 0 expected 0 +line file2 errorlevel 0 expected 0 +line file3 errorlevel 0 expected 0 Passed: Found expected dir1\file1 Passed: Found expected dir1\file2 Passed: Found expected dir1\file3 -Passed: Found expected file1 in COPY output -Passed: Found expected file2 in COPY output -Passed: Found expected file3 in COPY output +line file1 errorlevel 0 expected 0 +line file2 errorlevel 0 expected 0 +line file3 errorlevel 0 expected 0 Passed: Found expected file1 Passed: Found expected file2 Passed: Found expected file3 @@ -1970,42 +1970,42 @@ Passed: Did not find dir2 Passed: Did not find dir2\file1 Passed: Did not find dir2\file2 Passed: Did not find dir2\file3 -Passed: Did not find file2 in COPY output +line file2 errorlevel 1 expected 1 Passed: Found expected testfile -Passed: Found expected file1 in COPY output -Passed: Found expected file2 in COPY output +line file1 errorlevel 0 expected 0 +line file2 errorlevel 0 expected 0 Passed: Found expected testfile -Passed: Found expected file1 in COPY output -Passed: Found expected file2 in COPY output -Passed: Found expected file3 in COPY output +line file1 errorlevel 0 expected 0 +line file2 errorlevel 0 expected 0 +line file3 errorlevel 0 expected 0 Passed: Found expected testfile -Passed: Found expected file1 in COPY output -Passed: Found expected file2 in COPY output -Passed: Found expected file3 in COPY output -Passed: Found expected fred in COPY output +line file1 errorlevel 0 expected 0 +line file2 errorlevel 0 expected 0 +line file3 errorlevel 0 expected 0 +line fred errorlevel 0 expected 0 Passed: Found expected testfile -Passed: Found expected fred in COPY output -Passed: Found expected file1 in COPY output -Passed: Found expected file2 in COPY output -Passed: Found expected file3 in COPY output +line fred errorlevel 0 expected 0 +line file1 errorlevel 0 expected 0 +line file2 errorlevel 0 expected 0 +line file3 errorlevel 0 expected 0 Passed: Found expected testfile -Passed: Found expected fred in COPY output -Passed: Found expected file1 in COPY output -Passed: Found expected file2 in COPY output -Passed: Found expected file3 in COPY output +line fred errorlevel 0 expected 0 +line file1 errorlevel 0 expected 0 +line file2 errorlevel 0 expected 0 +line file3 errorlevel 0 expected 0 Passed: Found expected dir1\fred -Passed: Found expected fred in COPY output -Passed: Found expected file1 in COPY output -Passed: Found expected file2 in COPY output -Passed: Found expected file3 in COPY output +line fred errorlevel 0 expected 0 +line file1 errorlevel 0 expected 0 +line file2 errorlevel 0 expected 0 +line file3 errorlevel 0 expected 0 Passed: Found expected dir1\fred -Passed: Found expected fred in COPY output -Passed: Found expected file1 in COPY output -Passed: Found expected file2 in COPY output -Passed: Found expected file3 in COPY output +line fred errorlevel 0 expected 0 +line file1 errorlevel 0 expected 0 +line file2 errorlevel 0 expected 0 +line file3 errorlevel 0 expected 0 Passed: Found expected fred -Passed: Found expected fred in COPY output -Passed: Found expected file1 in COPY output +line fred errorlevel 0 expected 0 +line file1 errorlevel 0 expected 0 Passed: Found expected fred Passed: file size check on file1 [5]@or_broken@Skipping file size check on NT4 Passed: file size check on file2 [8]@or_broken@Skipping file size check on NT4