Alexander Coffin : cmd/tests: Add some tests for "choice".

Alexandre Julliard julliard at winehq.org
Wed Dec 26 17:47:10 CST 2018


Module: wine
Branch: master
Commit: fc358a82750fbec482ddddee7191f2723b503435
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=fc358a82750fbec482ddddee7191f2723b503435

Author: Alexander Coffin <alexcoffin1999 at gmail.com>
Date:   Tue Dec 18 19:25:01 2018 -0600

cmd/tests: Add some tests for "choice".

Signed-off-by: Alexander Coffin <alexcoffin1999 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/cmd/tests/test_builtins.cmd     | 42 ++++++++++++++++++++++++++++++++
 programs/cmd/tests/test_builtins.cmd.exp | 14 +++++++++++
 2 files changed, 56 insertions(+)

diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd
index 79233d8..f4dfc9f 100644
--- a/programs/cmd/tests/test_builtins.cmd
+++ b/programs/cmd/tests/test_builtins.cmd
@@ -527,6 +527,48 @@ rmdir "fol;der"
 rmdir folder
 PATH=%PATH_BACKUP%
 
+echo ------------ Testing 'choice' ------------
+
+rem Windows XP and Windows 2000 do not come with choice
+rem echo is used for @or_broken@ formatting
+choice /C:ABC /M "Example message" /D A /T:0
+if %ERRORLEVEL% EQU 9009 (
+  echo choice unavailable
+)
+echo %ERRORLEVEL%
+choice /C ABC "/M:Example message" /D:B /T 0
+if %ERRORLEVEL% EQU 9009 (
+  echo choice unavailable
+)
+echo %ERRORLEVEL%
+choice /C def /D:f /T:0
+if %ERRORLEVEL% EQU 9009 (
+  echo choice unavailable
+)
+echo %ERRORLEVEL%
+REM If a pipe fails due to a nonexistent command
+REM it will stop the whole program's execution
+if %ERRORLEVEL% NEQ 9009 (
+  echo Y | choice /C ABCXYZ /D A /T 2
+)
+if %ERRORLEVEL% EQU 9009 (
+  echo choice unavailable
+)
+echo %ERRORLEVEL%
+choice /C ABC /N /D A /T 0
+if %ERRORLEVEL% EQU 9009 (
+  echo choice unavailable
+)
+echo %ERRORLEVEL%
+choice /C abcABC /CS /D:A /T:0
+if %ERRORLEVEL% EQU 9009 (
+  echo choice unavailable
+)
+echo %ERRORLEVEL%
+rem intentional error
+choice /C abcABC /D:A /T:0 >NUL 2>NUL
+echo %ERRORLEVEL%
+
 echo ------------ Testing variable expansion ------------
 call :setError 0
 echo ~p0 should be path containing batch file
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index 01ddc4d..d78d91a 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -479,6 +479,20 @@ foo
 I'm here!@space@
 I'm here!@space@
 I'm here!@space@
+------------ Testing 'choice' ------------
+ at todo_wine@Example message [A,B,C]?A at or_broken@choice unavailable
+ at todo_wine@1 at or_broken@9009
+ at todo_wine@Example message [A,B,C]?B at or_broken@choice unavailable
+ at todo_wine@2 at or_broken@9009
+ at todo_wine@[D,E,F]?F at or_broken@choice unavailable
+ at todo_wine@3 at or_broken@9009
+ at todo_wine@[A,B,C,X,Y,Z]?Y at or_broken@choice unavailable
+ at todo_wine@5 at or_broken@9009
+ at todo_wine@A at or_broken@choice unavailable
+ at todo_wine@1 at or_broken@9009
+ at todo_wine@[a,b,c,A,B,C]?A at or_broken@choice unavailable
+ at todo_wine@4 at or_broken@9009
+ at todo_wine@255 at or_broken@9009
 ------------ Testing variable expansion ------------
 ~p0 should be path containing batch file
 @path@




More information about the wine-cvs mailing list