Commit fc358a82 authored by Alexander Coffin's avatar Alexander Coffin Committed by Alexandre Julliard

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

parent 889fe314
......@@ -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
......
......@@ -479,6 +479,20 @@ foo
I'm here!@space@
I'm here!@space@
I'm here!@space@
------------ Testing 'choice' ------------
@todo_wine@Example message [A,B,C]?A@or_broken@choice unavailable
@todo_wine@1@or_broken@9009
@todo_wine@Example message [A,B,C]?B@or_broken@choice unavailable
@todo_wine@2@or_broken@9009
@todo_wine@[D,E,F]?F@or_broken@choice unavailable
@todo_wine@3@or_broken@9009
@todo_wine@[A,B,C,X,Y,Z]?Y@or_broken@choice unavailable
@todo_wine@5@or_broken@9009
@todo_wine@A@or_broken@choice unavailable
@todo_wine@1@or_broken@9009
@todo_wine@[a,b,c,A,B,C]?A@or_broken@choice unavailable
@todo_wine@4@or_broken@9009
@todo_wine@255@or_broken@9009
------------ Testing variable expansion ------------
~p0 should be path containing batch file
@path@
......
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