cmd/tests: Test calling batch files named as builtin commands.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
Eric Pouech 2024-04-09 10:48:07 +02:00 committed by Alexandre Julliard
parent 8bbd48bfd8
commit 289c49ee21
2 changed files with 31 additions and 0 deletions

View file

@ -2711,7 +2711,13 @@ echo>robinfile
if 1==1 call del batfile if 1==1 call del batfile
dir /b dir /b
if exist batfile echo batfile shouldn't exist if exist batfile echo batfile shouldn't exist
rem arcane command, first resets errorlevel, second sets it to one
(call )
echo %ErrorLevel%
(call)
echo %ErrorLevel%
rem ... but not for 'if' or 'for' rem ... but not for 'if' or 'for'
call :setError 0
call if 1==1 echo bar 2> nul call if 1==1 echo bar 2> nul
echo %ErrorLevel% echo %ErrorLevel%
call :setError 0 call :setError 0
@ -2738,6 +2744,20 @@ call if 1==1 (
call call call echo passed call call call echo passed
cd .. & rd /s/q foobar cd .. & rd /s/q foobar
echo --- mixing batch and builtins
erase /q echo.bat test.bat 2> NUL
echo @echo foo> echo.bat
echo @echo bar> test.bat & call test.bat
echo @echo.bat bar> test.bat & call test.bat
echo @call echo bar> test.bat & call test.bat
echo @call echo.bat bar> test.bat & call test.bat
erase /q echo.bat 2> NUL
echo @echo bar> test.bat & call test.bat
echo @echo.bat bar> test.bat & call test.bat
echo @call echo bar> test.bat & call test.bat
echo @call echo.bat bar> test.bat & call test.bat
erase /q test.bat 2> NUL
echo ------------ Testing SHIFT ------------ echo ------------ Testing SHIFT ------------
call :shiftFun p1 p2 p3 p4 p5 call :shiftFun p1 p2 p3 p4 p5

View file

@ -1537,6 +1537,8 @@ foo created
Should expand foobaz Should expand foobaz
batfile batfile
robinfile robinfile
0
@todo_wine@1
1 1
1 1
non-builtin dir non-builtin dir
@ -1545,6 +1547,15 @@ Line two
Get if Get if
... and else! ... and else!
passed passed
--- mixing batch and builtins
bar@space@
@todo_wine@foo
foo
foo
bar@space@
bat bar@space@
bar@space@
bat bar@space@
------------ Testing SHIFT ------------ ------------ Testing SHIFT ------------
'p1' 'p2' 'p3' 'p4' 'p5' 'p1' 'p2' 'p3' 'p4' 'p5'
'p2' 'p3' 'p4' 'p5' '' 'p2' 'p3' 'p4' 'p5' ''