Commit 920bdcc4 authored by Frédéric Delanoy's avatar Frédéric Delanoy Committed by Alexandre Julliard

cmd/tests: Add setlocal/endlocal tests.

parent 8d328ff8
......@@ -650,6 +650,48 @@ call dir /b
cd ..
rd /s/q foobar
echo ------------ Testing setlocal/endlocal ------------
call :setError 0
rem Note: setlocal EnableDelayedExtension already tested in the variable delayed expansion test section
mkdir foobar & cd foobar
echo ...enable/disable extensions
setlocal DisableEXTensions
echo ErrLev: %ErrorLevel%
endlocal
echo ErrLev: %ErrorLevel%
echo @echo off> tmp.cmd
echo echo ErrLev: %%ErrorLevel%%>> tmp.cmd
rem Enabled by default
cmd /C tmp.cmd
cmd /E:OfF /C tmp.cmd
cmd /e:oN /C tmp.cmd
rem FIXME: creating file before setting envvar value to prevent parsing-time evaluation (due to EnableDelayedExpansion not being implemented/available yet)
echo ...setlocal with corresponding endlocal
echo @echo off> test.cmd
echo echo %%VAR%%>> test.cmd
echo setlocal>> test.cmd
echo set VAR=localval>> test.cmd
echo echo %%VAR%%>> test.cmd
echo endlocal>> test.cmd
echo echo %%VAR%%>> test.cmd
set VAR=globalval
call test.cmd
echo %VAR%
set VAR=
echo ...setlocal with no corresponding endlocal
echo @echo off> test.cmd
echo echo %%VAR%%>> test.cmd
echo setlocal>> test.cmd
echo set VAR=localval>> test.cmd
echo echo %%VAR%%>> test.cmd
set VAR=globalval
call test.cmd
echo %VAR%
set VAR=
cd ..
rd /q/s foobar
echo -----------Testing Errorlevel-----------
rem WARNING: Do *not* add tests using ErrorLevel after this section
should_not_exist 2> nul > nul
......
......@@ -331,6 +331,22 @@ foo ''
@todo_wine@1
@todo_wine@1
non-builtin dir
------------ Testing setlocal/endlocal ------------
...enable/disable extensions
@todo_wine@ErrLev:@space@
ErrLev: 0
ErrLev: 0
@todo_wine@ErrLev:@space@@or_broken@ErrLev: 0
ErrLev: 0
...setlocal with corresponding endlocal
globalval
localval
globalval
globalval
...setlocal with no corresponding endlocal
globalval
localval
@todo_wine@globalval
-----------Testing Errorlevel-----------
9009
1
......
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