Frédéric Delanoy : cmd/tests: Add CALL tests.

Alexandre Julliard julliard at winehq.org
Thu Jul 21 10:50:51 CDT 2011


Module: wine
Branch: master
Commit: 8f8aa7a35e3436199e83a6b2acbb5027fecd7768
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8f8aa7a35e3436199e83a6b2acbb5027fecd7768

Author: Frédéric Delanoy <frederic.delanoy at gmail.com>
Date:   Thu Jul 21 15:28:26 2011 +0200

cmd/tests: Add CALL tests.

---

 programs/cmd/tests/test_builtins.cmd     |   40 ++++++++++++++++++++++++++++++
 programs/cmd/tests/test_builtins.cmd.exp |   12 +++++++++
 2 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd
index 195afca..81a326a 100644
--- a/programs/cmd/tests/test_builtins.cmd
+++ b/programs/cmd/tests/test_builtins.cmd
@@ -361,6 +361,46 @@ if not exist 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-----------
 rem WARNING: Do *not* add tests using ErrorLevel after this section
 should_not_exist 2> nul > nul
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index 67f25a4..c3fee1a 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -174,6 +174,18 @@ non-empty dir not removed
 non-empty dir not removed
 recursive rmdir succeeded
 recursive rmdir succeeded
+------------ Testing CALL --------------
+foo
+foo 8
+bar :testRoutine
+ at todo_wine@0
+ at todo_wine@foo created
+ at todo_wine@Should expand foobaz
+ at todo_wine@batfile
+ at todo_wine@robinfile
+ at todo_wine@1
+ at todo_wine@1
+non-builtin dir
 -----------Testing Errorlevel-----------
 9009
 1




More information about the wine-cvs mailing list