[1/3] cmd/tests: Add tests for & (un)conditional execution

Frédéric Delanoy frederic.delanoy at gmail.com
Sat Jul 23 08:34:20 CDT 2011


---
 programs/cmd/tests/test_builtins.cmd     |   19 ++++++++++++++++---
 programs/cmd/tests/test_builtins.cmd.exp |    6 ++++++
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd
index 81a326a..88c7c75 100644
--- a/programs/cmd/tests/test_builtins.cmd
+++ b/programs/cmd/tests/test_builtins.cmd
@@ -94,6 +94,19 @@ echo P%ERRORLEVEL%
 echo %ERRORLEVEL%S
 echo P%ERRORLEVEL%S
 
+echo ------------ Testing conditional execution --------------
+echo ...unconditional ^&
+call :setError 123 & echo foo1
+echo bar2 & echo foo2
+mkdir foobar & cd foobar
+echo > foobazbar
+cd .. & rd /s/q foobar
+if exist foobazbar (
+    echo foobar not deleted!
+    cd ..
+    rd /s/q foobar
+) else echo foobar deleted
+
 echo ------------ Testing type ------------
 echo bar> foobaz
 @echo on
@@ -105,7 +118,7 @@ echo ***
 del foobaz
 
 echo ------------ Testing NUL ------------
-md foobar && cd foobar
+md foobar & cd foobar
 rem NUL file (non) creation + case insensitivity
 rem Note: "if exist" does not work with NUL, so to check for file existence we use a kludgy workaround
 echo > bar
@@ -277,7 +290,7 @@ echo %ErrorLevel%
 rem Trailing backslashes
 mkdir foo\\\\
 echo %ErrorLevel%
-if exist foo (rmdir foo && echo dir created
+if exist foo (rmdir foo & echo dir created
 ) else ( echo dir not created )
 echo %ErrorLevel%
 rem Invalid chars
@@ -289,7 +302,7 @@ echo %ErrorLevel%
 call :setError 0
 mkdir foo\?
 echo %ErrorLevel%
-if exist foo (rmdir foo && echo ok, foo created
+if exist foo (rmdir foo & echo ok, foo created
 ) else ( echo foo not created )
 call :setError 0
 mkdir foo\bar\?
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index c3fee1a..1c56629 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -90,6 +90,12 @@ ERRORLEVEL
 P0
 0S
 P0S
+------------ Testing conditional execution --------------
+ at todo_wine@...unconditional &
+foo1
+bar2 at space@
+foo2
+ at todo_wine@foobar deleted
 ------------ Testing type ------------
 
 @pwd@>type foobaz at space@
-- 
1.7.6




More information about the wine-patches mailing list