Frédéric Delanoy : cmd/tests: Add setlocal/ endlocal tests.

Alexandre Julliard julliard at winehq.org
Thu Aug 4 12:22:11 CDT 2011


Module: wine
Branch: master
Commit: 920bdcc4b82b9bb12f0df489296215e997f19c25
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=920bdcc4b82b9bb12f0df489296215e997f19c25

Author: Frédéric Delanoy <frederic.delanoy at gmail.com>
Date:   Thu Aug  4 11:50:47 2011 +0200

cmd/tests: Add setlocal/endlocal tests.

---

 programs/cmd/tests/test_builtins.cmd     |   42 ++++++++++++++++++++++++++++++
 programs/cmd/tests/test_builtins.cmd.exp |   16 +++++++++++
 2 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd
index 2321e12..a27c833 100644
--- a/programs/cmd/tests/test_builtins.cmd
+++ b/programs/cmd/tests/test_builtins.cmd
@@ -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
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index c430883..c4f0d76 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -331,6 +331,22 @@ foo ''
 @todo_wine at 1
 @todo_wine at 1
 non-builtin dir
+------------ Testing setlocal/endlocal ------------
+...enable/disable extensions
+ at todo_wine@ErrLev:@space@
+ErrLev: 0
+ErrLev: 0
+ at todo_wine@ErrLev:@space@@or_broken at ErrLev: 0
+ErrLev: 0
+...setlocal with corresponding endlocal
+globalval
+localval
+globalval
+globalval
+...setlocal with no corresponding endlocal
+globalval
+localval
+ at todo_wine@globalval
 -----------Testing Errorlevel-----------
 9009
 1




More information about the wine-cvs mailing list