mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 15:14:29 +00:00
cmd/tests: Add tests for variable delayed expansion.
This commit is contained in:
parent
bb44fe5698
commit
3c8674a721
|
@ -168,6 +168,46 @@ echo P%ERRORLEVEL%
|
|||
echo %ERRORLEVEL%S
|
||||
echo P%ERRORLEVEL%S
|
||||
|
||||
echo ------------ Testing variable delayed expansion --------------
|
||||
rem NT4 doesn't support this
|
||||
echo ...default mode (load-time expansion)
|
||||
set FOO=foo
|
||||
echo %FOO%
|
||||
echo !FOO!
|
||||
if %FOO% == foo (
|
||||
set FOO=bar
|
||||
if %FOO% == bar (echo bar) else echo foo
|
||||
)
|
||||
|
||||
set FOO=foo
|
||||
if %FOO% == foo (
|
||||
set FOO=bar
|
||||
if !FOO! == bar (echo bar) else echo foo
|
||||
)
|
||||
|
||||
echo ...runtime (delayed) expansion mode
|
||||
setlocal EnableDelayedExpansion
|
||||
set FOO=foo
|
||||
echo %FOO%
|
||||
echo !FOO!
|
||||
if %FOO% == foo (
|
||||
set FOO=bar
|
||||
if %FOO% == bar (echo bar) else echo foo
|
||||
)
|
||||
|
||||
set FOO=foo
|
||||
if %FOO% == foo (
|
||||
set FOO=bar
|
||||
if !FOO! == bar (echo bar) else echo foo
|
||||
)
|
||||
echo %ErrorLevel%
|
||||
setlocal DisableDelayedExpansion
|
||||
echo %ErrorLevel%
|
||||
set FOO=foo
|
||||
echo %FOO%
|
||||
echo !FOO!
|
||||
set FOO=
|
||||
|
||||
echo ------------ Testing conditional execution --------------
|
||||
echo ...unconditional ^&
|
||||
call :setError 123 & echo foo1
|
||||
|
|
|
@ -146,6 +146,21 @@ ERRORLEVEL
|
|||
P0
|
||||
0S
|
||||
P0S
|
||||
------------ Testing variable delayed expansion --------------
|
||||
...default mode (load-time expansion)
|
||||
foo
|
||||
!FOO!
|
||||
foo
|
||||
foo
|
||||
...runtime (delayed) expansion mode
|
||||
foo
|
||||
@todo_wine@foo@or_broken@!FOO!
|
||||
foo
|
||||
@todo_wine@bar@or_broken@foo
|
||||
0
|
||||
0@or_broken@1
|
||||
foo
|
||||
!FOO!
|
||||
------------ Testing conditional execution --------------
|
||||
@todo_wine@...unconditional &
|
||||
foo1
|
||||
|
|
Loading…
Reference in a new issue