[PATCH v2 1/2] cmd: Tests for "choice"
Alexander Coffin
alexcoffin1999 at gmail.com
Tue Dec 18 19:25:01 CST 2018
From: alex <alexcoffin1999 at gmail.com>
Added currently unsuccessful tests for the "choice" command.
Signed-off-by: Alexander Coffin <alexcoffin1999 at gmail.com>
---
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@
--
2.7.4
More information about the wine-devel
mailing list