Commit 8f8aa7a3 authored by Frédéric Delanoy's avatar Frédéric Delanoy Committed by Alexandre Julliard

cmd/tests: Add CALL tests.

parent c47c62a8
...@@ -361,6 +361,46 @@ if not exist foo ( ...@@ -361,6 +361,46 @@ if not exist foo (
rd foo rd foo
) )
echo ------------ Testing CALL --------------
mkdir foobar & cd foobar
rem External script
echo echo foo %%1 > foo.cmd
call foo
call foo.cmd 8
del foo.cmd
rem Internal routines
call :testRoutine :testRoutine
goto :endTestRoutine
:testRoutine
echo bar %1
goto :eof
:endTestRoutine
rem Should work for builtins...
call mkdir foo
echo %ErrorLevel%
if exist foo (echo foo created) else echo foo should exist!
rmdir foo
set FOOBAZ_VAR=foobaz
call echo Should expand %FOOBAZ_VAR%
set FOOBAZ_VAR=
echo>batfile
call dir /b
echo>robinfile
if 1==1 call del batfile
dir /b
if exist batfile echo batfile shouldn't exist
rem ... but not for 'if' or 'for'
call if 1==1 echo bar 2> nul
echo %ErrorLevel%
call :setError 0
call for %%i in (foo bar baz) do echo %%i 2> nul
echo %ErrorLevel%
rem First look for programs in the path before trying a builtin
echo echo non-builtin dir > dir.cmd
call dir /b
cd ..
rd /s/q foobar
echo -----------Testing Errorlevel----------- echo -----------Testing Errorlevel-----------
rem WARNING: Do *not* add tests using ErrorLevel after this section rem WARNING: Do *not* add tests using ErrorLevel after this section
should_not_exist 2> nul > nul should_not_exist 2> nul > nul
......
...@@ -174,6 +174,18 @@ non-empty dir not removed ...@@ -174,6 +174,18 @@ non-empty dir not removed
non-empty dir not removed non-empty dir not removed
recursive rmdir succeeded recursive rmdir succeeded
recursive rmdir succeeded recursive rmdir succeeded
------------ Testing CALL --------------
foo
foo 8
bar :testRoutine
@todo_wine@0
@todo_wine@foo created
@todo_wine@Should expand foobaz
@todo_wine@batfile
@todo_wine@robinfile
@todo_wine@1
@todo_wine@1
non-builtin dir
-----------Testing Errorlevel----------- -----------Testing Errorlevel-----------
9009 9009
1 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment