cmd/tests: Tweak subsection headers so they are treated as resynchronization points.

This commit is contained in:
Francois Gouget 2011-11-29 11:46:16 +01:00 committed by Alexandre Julliard
parent 128d0656de
commit 87a770fa73
2 changed files with 141 additions and 141 deletions

View file

@ -89,7 +89,7 @@ rem@tab@echo foo & echo bar
echo ------------ Testing redirection operators ------------ echo ------------ Testing redirection operators ------------
mkdir foobar & cd foobar mkdir foobar & cd foobar
echo ...stdout redirection echo --- stdout redirection
echo foo>foo echo foo>foo
type foo type foo
echo foo 1> foo echo foo 1> foo
@ -113,7 +113,7 @@ type foo
del foo del foo
echo1>foo echo1>foo
type foo type foo
echo ...stdout appending echo --- stdout appending
echo foo>foo echo foo>foo
echo foo >>foo echo foo >>foo
type foo type foo
@ -133,7 +133,7 @@ del foo
echo foo> foo echo foo> foo
echo foo7 7>> foo || (echo not supported & del foo) echo foo7 7>> foo || (echo not supported & del foo)
if exist foo (type foo) else echo not supported if exist foo (type foo) else echo not supported
echo ...redirections within IF statements echo --- redirections within IF statements
if 1==1 echo foo1>bar if 1==1 echo foo1>bar
type bar & del bar type bar & del bar
if 1==1 (echo foo2>bar) else echo baz2>bar if 1==1 (echo foo2>bar) else echo baz2>bar
@ -286,7 +286,7 @@ echo %VAR:~-3,-2%
set VAR= set VAR=
echo ------------ Testing variable substitution ------------ echo ------------ Testing variable substitution ------------
echo ...in FOR variables echo --- in FOR variables
for %%i in ("A B" C) do echo %%i for %%i in ("A B" C) do echo %%i
rem quotes removal rem quotes removal
for %%i in ("A B" C) do echo '%%~i' for %%i in ("A B" C) do echo '%%~i'
@ -319,7 +319,7 @@ for %%i in ("g h" i) do echo %%~sdi
for %%i in ("g h" i) do echo %%~dsi for %%i in ("g h" i) do echo %%~dsi
for %%i in ("j k" l.eh) do echo '%%~xsi' for %%i in ("j k" l.eh) do echo '%%~xsi'
echo ...in parameters echo --- in parameters
for %%i in ("A B" C) do call :echoFun %%i for %%i in ("A B" C) do call :echoFun %%i
rem quotes removal rem quotes removal
for %%i in ("A B" C) do call :echoFunQ %%i for %%i in ("A B" C) do call :echoFunQ %%i
@ -397,7 +397,7 @@ goto :eof
echo ------------ Testing variable delayed expansion ------------ echo ------------ Testing variable delayed expansion ------------
rem NT4 doesn't support this rem NT4 doesn't support this
echo ...default mode (load-time expansion) echo --- default mode (load-time expansion)
set FOO=foo set FOO=foo
echo %FOO% echo %FOO%
echo !FOO! echo !FOO!
@ -412,7 +412,7 @@ if %FOO% == foo (
if !FOO! == bar (echo bar) else echo foo if !FOO! == bar (echo bar) else echo foo
) )
echo ...runtime (delayed) expansion mode echo --- runtime (delayed) expansion mode
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
set FOO=foo set FOO=foo
echo %FOO% echo %FOO%
@ -434,7 +434,7 @@ set FOO=foo
echo %FOO% echo %FOO%
echo !FOO! echo !FOO!
set FOO= set FOO=
echo ...using /V cmd flag echo --- using /V cmd flag
echo @echo off> tmp.cmd echo @echo off> tmp.cmd
echo set FOO=foo>> tmp.cmd echo set FOO=foo>> tmp.cmd
echo echo %%FOO%%>> tmp.cmd echo echo %%FOO%%>> tmp.cmd
@ -445,7 +445,7 @@ cmd /V:OfF /C tmp.cmd
del tmp.cmd del tmp.cmd
echo ------------ Testing conditional execution ------------ echo ------------ Testing conditional execution ------------
echo ...unconditional ^& echo --- unconditional ampersand
call :setError 123 & echo foo1 call :setError 123 & echo foo1
echo bar2 & echo foo2 echo bar2 & echo foo2
mkdir foobar & cd foobar mkdir foobar & cd foobar
@ -456,14 +456,14 @@ if exist foobazbar (
cd .. cd ..
rd /s/q foobar rd /s/q foobar
) else echo foobar deleted ) else echo foobar deleted
echo ...on success conditional ^&^& echo --- on success conditional and
call :setError 456 && echo foo3 > foo3 call :setError 456 && echo foo3 > foo3
if exist foo3 ( if exist foo3 (
echo foo3 created echo foo3 created
del foo3 del foo3
) else echo foo3 not created ) else echo foo3 not created
echo bar4 && echo foo4 echo bar4 && echo foo4
echo ...on failure conditional ^|^| echo --- on failure conditional or
call :setError 789 || echo foo5 call :setError 789 || echo foo5
echo foo6 || echo bar6 > bar6 echo foo6 || echo bar6 > bar6
if exist bar6 ( if exist bar6 (
@ -518,10 +518,10 @@ echo ------------ Testing type ------------
echo bar> foobaz echo bar> foobaz
@echo on @echo on
type foobaz type foobaz
echo *** echo ---
@echo off @echo off
type foobaz@tab@ type foobaz@tab@
echo *** echo ---
del foobaz del foobaz
echo ------------ Testing NUL ------------ echo ------------ Testing NUL ------------
@ -593,7 +593,7 @@ if 1==0 (echo doom)@tab@else echo quake
if 1==0 (echo doom) else@tab@echo quake if 1==0 (echo doom) else@tab@echo quake
echo ------------ Testing for ------------ echo ------------ Testing for ------------
echo ...plain FOR echo --- plain FOR
for %%i in (A B C) do echo %%i for %%i in (A B C) do echo %%i
for %%i in (A B C) do echo %%I for %%i in (A B C) do echo %%I
for %%i in (A B C) do echo %%j for %%i in (A B C) do echo %%j
@ -616,7 +616,7 @@ goto :endForTestFun1
echo %1 echo %1
goto :eof goto :eof
:endForTestFun1 :endForTestFun1
echo ...imbricated FORs echo --- imbricated FORs
for %%i in (X) do ( for %%i in (X) do (
for %%j in (Y) do ( for %%j in (Y) do (
echo %%i %%j)) echo %%i %%j))
@ -639,9 +639,9 @@ mkdir foo
mkdir bar mkdir bar
mkdir baz mkdir baz
echo > bazbaz echo > bazbaz
echo ...basic wildcards echo --- basic wildcards
for %%i in (ba*) do echo %%i for %%i in (ba*) do echo %%i
echo ...for /d echo --- for /d
for /d %%i in (baz foo bar) do echo %%i for /d %%i in (baz foo bar) do echo %%i
rem FIXME for /d incorrectly parses when wildcards are used rem FIXME for /d incorrectly parses when wildcards are used
rem for /d %%i in (bazb*) do echo %%i rem for /d %%i in (bazb*) do echo %%i
@ -658,7 +658,7 @@ rem for /d %%i in (*) do echo %%i>> tmp
rem sort < tmp rem sort < tmp
rem del tmp rem del tmp
cd .. & rd /s/Q foobar cd .. & rd /s/Q foobar
echo ...for /L echo --- for /L
rem Some cases loop forever writing 0s, like e.g. (1,0,1), (1,a,3) or (a,b,c); those can't be tested here rem Some cases loop forever writing 0s, like e.g. (1,0,1), (1,a,3) or (a,b,c); those can't be tested here
for /L %%i in (1,2,0) do echo %%i for /L %%i in (1,2,0) do echo %%i
for@tab@/L %%i in (1,2,0) do echo %%i for@tab@/L %%i in (1,2,0) do echo %%i
@ -678,10 +678,10 @@ rem for /L %%i in (1,1,1) do echo %%i
rem for /L %%i in (1,-2,-1) do echo %%i rem for /L %%i in (1,-2,-1) do echo %%i
rem for /L %%i in (-1,-1,-1) do echo %%i rem for /L %%i in (-1,-1,-1) do echo %%i
rem for /L %%i in (1,2, 3) do echo %%i rem for /L %%i in (1,2, 3) do echo %%i
echo ...for /a echo --- for /a
rem No output when using "set expr" syntax, unless in interactive mode rem No output when using "set expr" syntax, unless in interactive mode
rem Need to use "set envvar=expr" to use in a batch script rem Need to use "set envvar=expr" to use in a batch script
echo ......individual operations echo ------ individual operations
set var=0 set var=0
set /a var=1 +2 & echo %var% set /a var=1 +2 & echo %var%
set /a var=1 +-2 & echo %var% set /a var=1 +-2 & echo %var%
@ -721,7 +721,7 @@ set /a var=5 ^^ 1 & echo %var%
set /a var=5 ^^ 3 & echo %var% set /a var=5 ^^ 3 & echo %var%
set /a var=5 ^^ 4 & echo %var% set /a var=5 ^^ 4 & echo %var%
set /a var=5 ^^ 1 & echo %var% set /a var=5 ^^ 1 & echo %var%
echo ......precedence and grouping echo ------ precedence and grouping
set /a var=4 + 2*3 & echo %var% set /a var=4 + 2*3 & echo %var%
set /a var=(4+2)*3 & echo %var% set /a var=(4+2)*3 & echo %var%
set /a var=4 * 3/5 & echo %var% set /a var=4 * 3/5 & echo %var%
@ -730,12 +730,12 @@ set /a var=4 * 5 %% 4 & echo %var%
set /a var=4 * (5 %% 4) & echo %var% set /a var=4 * (5 %% 4) & echo %var%
set /a var=3 %% (5 + 8 %% 3 ^^ 2) & echo %var% set /a var=3 %% (5 + 8 %% 3 ^^ 2) & echo %var%
set /a var=3 %% (5 + 8 %% 3 ^^ -2) & echo %var% set /a var=3 %% (5 + 8 %% 3 ^^ -2) & echo %var%
echo ......octal and hexadecimal echo ------ octal and hexadecimal
set /a var=0xf + 3 & echo %var% set /a var=0xf + 3 & echo %var%
set /a var=0xF + 3 & echo %var% set /a var=0xF + 3 & echo %var%
set /a var=015 + 2 & echo %var% set /a var=015 + 2 & echo %var%
set /a var=3, 8+3,0 & echo %var% set /a var=3, 8+3,0 & echo %var%
echo ......variables echo ------ variables
set /a var=foo=3, foo+1 & echo %var% set /a var=foo=3, foo+1 & echo %var%
if defined foo (echo %foo%) else ( if defined foo (echo %foo%) else (
echo foo not defined echo foo not defined
@ -757,16 +757,16 @@ set /a var=foo=19, foo %%= 4 + (bar %%= 7) & echo.
set foo= set foo=
set bar= set bar=
set var= set var=
echo ...for /F echo --- for /F
mkdir foobar & cd foobar mkdir foobar & cd foobar
echo ......string argument echo ------ string argument
for /F %%i in ("a b c") do echo %%i for /F %%i in ("a b c") do echo %%i
for /f %%i in ("a ") do echo %%i for /f %%i in ("a ") do echo %%i
for /f %%i in ("a") do echo %%i for /f %%i in ("a") do echo %%i
fOr /f %%i in (" a") do echo %%i fOr /f %%i in (" a") do echo %%i
for /f %%i in (" a ") do echo %%i for /f %%i in (" a ") do echo %%i
echo ......fileset argument echo ------ fileset argument
echo .........basic blank handling echo --------- basic blank handling
echo a b c>foo echo a b c>foo
for /f %%i in (foo) do echo %%i for /f %%i in (foo) do echo %%i
echo a >foo echo a >foo
@ -782,7 +782,7 @@ for /f %%i in (foo) do echo %%i
echo. >> foo echo. >> foo
echo b > foo echo b > foo
for /f %%i in (foo) do echo %%i for /f %%i in (foo) do echo %%i
echo .........multi-line with empty lines echo --------- multi-line with empty lines
echo a Z f> foo echo a Z f> foo
echo. >> foo echo. >> foo
echo.>> foo echo.>> foo
@ -790,20 +790,20 @@ echo b bC>> foo
echo c>> foo echo c>> foo
echo. >> foo echo. >> foo
for /f %%b in (foo) do echo %%b for /f %%b in (foo) do echo %%b
echo .........multiple files echo --------- multiple files
echo q w > bar echo q w > bar
echo.>> bar echo.>> bar
echo kkk>>bar echo kkk>>bar
for /f %%k in (foo bar) do echo %%k for /f %%k in (foo bar) do echo %%k
for /f %%k in (bar foo) do echo %%k for /f %%k in (bar foo) do echo %%k
rem echo ......command argument rem echo ------ command argument
rem Not implemented on NT4 rem Not implemented on NT4
rem FIXME: Not testable right now in wine: not implemented and would need rem FIXME: Not testable right now in wine: not implemented and would need
rem preliminary grep-like program implementation (e.g. like findstr or fc) even rem preliminary grep-like program implementation (e.g. like findstr or fc) even
rem for a simple todo_wine test rem for a simple todo_wine test
rem (for /f "usebackq" %%i in (`echo z a b`) do echo %%i) || echo not supported rem (for /f "usebackq" %%i in (`echo z a b`) do echo %%i) || echo not supported
rem (for /f usebackq %%i in (`echo z a b`) do echo %%i) || echo not supported rem (for /f usebackq %%i in (`echo z a b`) do echo %%i) || echo not supported
echo ......eol option echo ------ eol option
for /f "eol=@" %%i in (" ad") do echo %%i for /f "eol=@" %%i in (" ad") do echo %%i
for /f "eol=@" %%i in (" z@y") do echo %%i for /f "eol=@" %%i in (" z@y") do echo %%i
for /f "eol=|" %%i in ("a|d") do echo %%i for /f "eol=|" %%i in ("a|d") do echo %%i
@ -811,7 +811,7 @@ for /f "eol=@" %%i in ("@y") do echo %%i > output_file
if not exist output_file (echo no output) else (del output_file) if not exist output_file (echo no output) else (del output_file)
for /f "eol==" %%i in ("=y") do echo %%i > output_file for /f "eol==" %%i in ("=y") do echo %%i > output_file
if not exist output_file (echo no output) else (del output_file) if not exist output_file (echo no output) else (del output_file)
echo ......delims option echo ------ delims option
for /f "delims=|" %%i in ("a|d") do echo %%i for /f "delims=|" %%i in ("a|d") do echo %%i
for /f "delims=|" %%i in ("a |d") do echo %%i for /f "delims=|" %%i in ("a |d") do echo %%i
for /f "delims=|" %%i in ("a d|") do echo %%i for /f "delims=|" %%i in ("a d|") do echo %%i
@ -819,7 +819,7 @@ for /f "delims=| " %%i in ("a d|") do echo %%i
for /f "delims==" %%i in ("C r=d|") do echo %%i for /f "delims==" %%i in ("C r=d|") do echo %%i
for /f "delims=" %%i in ("foo bar baz") do echo %%i for /f "delims=" %%i in ("foo bar baz") do echo %%i
for /f "delims=" %%i in ("c:\foo bar baz\..") do echo %%~fi for /f "delims=" %%i in ("c:\foo bar baz\..") do echo %%~fi
echo ......skip option echo ------ skip option
echo a > foo echo a > foo
echo b >> foo echo b >> foo
echo c >> foo echo c >> foo
@ -883,7 +883,7 @@ rmdir "foo bar"
echo ------------ Testing rename ------------ echo ------------ Testing rename ------------
mkdir foobar & cd foobar mkdir foobar & cd foobar
echo ... ren and rename are synonymous ... echo --- ren and rename are synonymous
echo > foo echo > foo
rename foo bar rename foo bar
if exist foo echo foo should be renamed! if exist foo echo foo should be renamed!
@ -891,7 +891,7 @@ if exist bar echo foo renamed to bar
ren bar foo ren bar foo
if exist bar echo bar should be renamed! if exist bar echo bar should be renamed!
if exist foo echo bar renamed to foo if exist foo echo bar renamed to foo
echo ... name collision ... echo --- name collision
echo foo>foo echo foo>foo
echo bar>bar echo bar>bar
ren foo bar 2> nul ren foo bar 2> nul
@ -901,7 +901,7 @@ rem no-op
ren foo foo ren foo foo
mkdir baz mkdir baz
ren foo baz\abc ren foo baz\abc
echo ... rename read-only files ... echo --- rename read-only files
echo > file1 echo > file1
attrib +r file1 attrib +r file1
ren file1 file2 ren file1 file2
@ -912,7 +912,7 @@ if not exist file1 (
) else ( ) else (
echo read-only file not renamed! echo read-only file not renamed!
) )
echo ... rename directories ... echo --- rename directories
mkdir rep1 mkdir rep1
ren rep1 rep2 ren rep1 rep2
if not exist rep1 ( if not exist rep1 (
@ -927,7 +927,7 @@ if not exist rep2 (
echo read-only dir renamed echo read-only dir renamed
) )
) )
echo ... rename in other directory ... echo --- rename in other directory
if not exist baz\abc ( if not exist baz\abc (
echo rename impossible in other directory echo rename impossible in other directory
if exist foo echo original file still present if exist foo echo original file still present
@ -939,7 +939,7 @@ cd .. & rd /s/q foobar
echo ------------ Testing move ------------ echo ------------ Testing move ------------
mkdir foobar & cd foobar mkdir foobar & cd foobar
echo ... file move ... echo --- file move
echo >foo echo >foo
move foo bar > nul 2>&1 move foo bar > nul 2>&1
if not exist foo ( if not exist foo (
@ -989,7 +989,7 @@ if errorlevel 1 (
echo ErrorLevel: %ErrorLevel% echo ErrorLevel: %ErrorLevel%
call :setError 0 call :setError 0
del baz del baz
echo ... directory move ... echo --- directory move
mkdir foo\bar mkdir foo\bar
mkdir baz mkdir baz
echo baz2>baz\baz2 echo baz2>baz\baz2
@ -1003,7 +1003,7 @@ call :setError 0
mkdir baz mkdir baz
move baz baz > nul 2>&1 move baz baz > nul 2>&1
echo moving a directory to itself gives error; errlevel %ErrorLevel% echo moving a directory to itself gives error; errlevel %ErrorLevel%
echo ...... dir in dir move ...... echo ------ dir in dir move
rd /s/q foo rd /s/q foo
mkdir foo bar mkdir foo bar
echo foo2>foo\foo2 echo foo2>foo\foo2
@ -1020,14 +1020,14 @@ cd .. & rd /s/q foobar
echo ------------ Testing mkdir ------------ echo ------------ Testing mkdir ------------
call :setError 0 call :setError 0
echo ... md and mkdir are synonymous ... echo --- md and mkdir are synonymous
mkdir foobar mkdir foobar
echo %ErrorLevel% echo %ErrorLevel%
rmdir foobar rmdir foobar
md foobar md foobar
echo %ErrorLevel% echo %ErrorLevel%
rmdir foobar rmdir foobar
echo ... creating an already existing directory/file must fail ... echo --- creating an already existing directory/file must fail
mkdir foobar mkdir foobar
md foobar md foobar
echo %ErrorLevel% echo %ErrorLevel%
@ -1036,7 +1036,7 @@ echo > foobar
mkdir foobar mkdir foobar
echo %ErrorLevel% echo %ErrorLevel%
del foobar del foobar
echo ... multilevel path creation ... echo --- multilevel path creation
mkdir foo mkdir foo
echo %ErrorLevel% echo %ErrorLevel%
mkdir foo\bar\baz mkdir foo\bar\baz
@ -1061,13 +1061,13 @@ rmdir bar
cd .. cd ..
rmdir foo rmdir foo
echo %ErrorLevel% echo %ErrorLevel%
echo ... trailing backslashes ... echo --- trailing backslashes
mkdir foo\\\\ mkdir foo\\\\
echo %ErrorLevel% echo %ErrorLevel%
if exist foo (rmdir foo & echo dir created if exist foo (rmdir foo & echo dir created
) else ( echo dir not created ) ) else ( echo dir not created )
echo %ErrorLevel% echo %ErrorLevel%
echo ... invalid chars ... echo --- invalid chars
mkdir ? mkdir ?
echo mkdir ? gives errorlevel %ErrorLevel% echo mkdir ? gives errorlevel %ErrorLevel%
call :setError 0 call :setError 0
@ -1093,7 +1093,7 @@ if not exist foo (
cd .. cd ..
rmdir foo rmdir foo
) )
echo ... multiple directories at once ... echo --- multiple directories at once
mkdir foobaz & cd foobaz mkdir foobaz & cd foobaz
mkdir foo bar\baz foobar mkdir foo bar\baz foobar
if exist foo (echo foo created) else echo foo not created! if exist foo (echo foo created) else echo foo not created!
@ -1174,13 +1174,13 @@ cd .. & rd /s/q foobaz
echo ------------ Testing pushd/popd ------------ echo ------------ Testing pushd/popd ------------
cd cd
echo ...popd is no-op when dir stack is empty echo --- popd is no-op when dir stack is empty
popd popd
cd cd
echo ...pushing non-existing dir echo --- pushing non-existing dir
pushd foobar pushd foobar
cd cd
echo ...basic behaviour echo --- basic behaviour
mkdir foobar\baz mkdir foobar\baz
pushd foobar pushd foobar
cd cd
@ -1211,7 +1211,7 @@ mkdir foobar & cd foobar
echo foo original contents> foo echo foo original contents> foo
attrib foo attrib foo
echo > bar echo > bar
echo ... read-only attribute echo --- read-only attribute
rem Read-only files cannot be altered or deleted, unless forced rem Read-only files cannot be altered or deleted, unless forced
attrib +R foo attrib +R foo
attrib foo attrib foo
@ -1233,7 +1233,7 @@ if not exist foo (
del foo del foo
) )
cd .. & rd /s/q foobar cd .. & rd /s/q foobar
echo ... recursive behaviour echo --- recursive behaviour
mkdir foobar\baz & cd foobar mkdir foobar\baz & cd foobar
echo > level1 echo > level1
echo > whatever echo > whatever
@ -1247,7 +1247,7 @@ attrib baz\level2
echo > bar echo > bar
attrib bar attrib bar
cd .. & rd /s/q foobar cd .. & rd /s/q foobar
echo ... folders processing echo --- folders processing
mkdir foobar mkdir foobar
attrib foobar attrib foobar
cd foobar cd foobar
@ -1267,10 +1267,10 @@ echo ------------ Testing assoc ------------
rem FIXME Can't test error messages in the current test system, so we have to use some kludges rem FIXME Can't test error messages in the current test system, so we have to use some kludges
rem FIXME Revise once || conditional execution is fixed rem FIXME Revise once || conditional execution is fixed
mkdir foobar & cd foobar mkdir foobar & cd foobar
echo ...setting association echo --- setting association
assoc .foo > baz assoc .foo > baz
type baz type baz
echo *** echo ---
assoc .foo=bar assoc .foo=bar
assoc .foo assoc .foo
@ -1281,26 +1281,26 @@ echo echo +++>> tmp.cmd
echo assoc .foo>> tmp.cmd echo assoc .foo>> tmp.cmd
cmd /c tmp.cmd cmd /c tmp.cmd
echo ...resetting association echo --- resetting association
assoc .foo= assoc .foo=
assoc .foo > baz assoc .foo > baz
type baz type baz
echo *** echo ---
rem association removal set system-wide rem association removal set system-wide
cmd /c tmp.cmd > baz cmd /c tmp.cmd > baz
type baz type baz
echo *** echo ---
cd .. & rd /s/q foobar cd .. & rd /s/q foobar
echo ------------ Testing ftype ------------ echo ------------ Testing ftype ------------
rem FIXME Can't test error messages in the current test system, so we have to use some kludges rem FIXME Can't test error messages in the current test system, so we have to use some kludges
rem FIXME Revise once || conditional execution is fixed rem FIXME Revise once || conditional execution is fixed
mkdir foobar & cd foobar mkdir foobar & cd foobar
echo ...setting association echo --- setting association
ftype footype> baz ftype footype> baz
type baz type baz
echo *** echo ---
ftype footype=foo_opencmd ftype footype=foo_opencmd
assoc .foo=footype assoc .foo=footype
@ -1312,7 +1312,7 @@ echo echo +++>> tmp.cmd
echo ftype footype>> tmp.cmd echo ftype footype>> tmp.cmd
cmd /c tmp.cmd cmd /c tmp.cmd
echo ...resetting association echo --- resetting association
assoc .foo= assoc .foo=
rem Removing a file type association doesn't work on XP due to a bug, so a workaround is needed rem Removing a file type association doesn't work on XP due to a bug, so a workaround is needed
@ -1337,7 +1337,7 @@ cd .. & rd /s/q foobar
echo ------------ Testing CALL ------------ echo ------------ Testing CALL ------------
mkdir foobar & cd foobar mkdir foobar & cd foobar
echo ... external script ... echo --- external script
echo echo foo %%1> foo.cmd echo echo foo %%1> foo.cmd
call foo call foo
call foo.cmd 8 call foo.cmd 8
@ -1350,7 +1350,7 @@ call foo.cmd foo ''
call foo.cmd '' bar call foo.cmd '' bar
del foo.cmd del foo.cmd
echo ... internal routines ... echo --- internal routines
call :testRoutine :testRoutine call :testRoutine :testRoutine
goto :endTestRoutine goto :endTestRoutine
:testRoutine :testRoutine
@ -1370,7 +1370,7 @@ echo %1 %2
goto :eof goto :eof
:endTestRoutineArgs :endTestRoutineArgs
echo ... with builtins ... echo --- with builtins
call mkdir foo call mkdir foo
echo %ErrorLevel% echo %ErrorLevel%
if exist foo (echo foo created) else echo foo should exist! if exist foo (echo foo created) else echo foo should exist!
@ -1417,7 +1417,7 @@ goto :eof
echo ------------ Testing cmd invocation ------------ echo ------------ Testing cmd invocation ------------
rem FIXME: only a stub ATM rem FIXME: only a stub ATM
echo ... a batch file can delete itself ... echo --- a batch file can delete itself
echo del foo.cmd>foo.cmd echo del foo.cmd>foo.cmd
cmd /q /c foo.cmd cmd /q /c foo.cmd
if not exist foo.cmd ( if not exist foo.cmd (
@ -1426,7 +1426,7 @@ if not exist foo.cmd (
echo file should be deleted! echo file should be deleted!
del foo.cmd del foo.cmd
) )
echo ... a batch file can alter itself ... echo --- a batch file can alter itself
echo echo bar^>foo.cmd>foo.cmd echo echo bar^>foo.cmd>foo.cmd
cmd /q /c foo.cmd > NUL 2>&1 cmd /q /c foo.cmd > NUL 2>&1
if exist foo.cmd ( if exist foo.cmd (
@ -1440,7 +1440,7 @@ echo ------------ Testing setlocal/endlocal ------------
call :setError 0 call :setError 0
rem Note: setlocal EnableDelayedExpansion already tested in the variable delayed expansion test section rem Note: setlocal EnableDelayedExpansion already tested in the variable delayed expansion test section
mkdir foobar & cd foobar mkdir foobar & cd foobar
echo ...enable/disable extensions echo --- enable/disable extensions
setlocal DisableEXTensions setlocal DisableEXTensions
echo ErrLev: %ErrorLevel% echo ErrLev: %ErrorLevel%
endlocal endlocal
@ -1453,7 +1453,7 @@ cmd /E:OfF /C tmp.cmd
cmd /e:oN /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) 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 --- setlocal with corresponding endlocal
echo @echo off> test.cmd echo @echo off> test.cmd
echo echo %%VAR%%>> test.cmd echo echo %%VAR%%>> test.cmd
echo setlocal>> test.cmd echo setlocal>> test.cmd
@ -1465,7 +1465,7 @@ set VAR=globalval
call test.cmd call test.cmd
echo %VAR% echo %VAR%
set VAR= set VAR=
echo ...setlocal with no corresponding endlocal echo --- setlocal with no corresponding endlocal
echo @echo off> test.cmd echo @echo off> test.cmd
echo echo %%VAR%%>> test.cmd echo echo %%VAR%%>> test.cmd
echo setlocal>> test.cmd echo setlocal>> test.cmd

View file

@ -134,7 +134,7 @@ bar2
@pwd@>rem@tab@echo foo & echo bar@space@ @pwd@>rem@tab@echo foo & echo bar@space@
------------ Testing redirection operators ------------ ------------ Testing redirection operators ------------
...stdout redirection --- stdout redirection
foo foo
foo@space@ foo@space@
foo@tab@ foo@tab@
@ -145,7 +145,7 @@ foo9@space@@or_broken@foo@tab@
foo1 foo1
foo11 foo11
foo12 foo12
...stdout appending --- stdout appending
foo foo
foo@space@ foo@space@
foob@space@ foob@space@
@ -161,7 +161,7 @@ food2
food21 food21
@todo_wine@foo7@space@@space@@or_broken@not supported@space@ @todo_wine@foo7@space@@space@@or_broken@not supported@space@
@todo_wine@foo@or_broken@not supported @todo_wine@foo@or_broken@not supported
...redirections within IF statements --- redirections within IF statements
@todo_wine@foo1 @todo_wine@foo1
@todo_wine@foo2 @todo_wine@foo2
@todo_wine@foo3 @todo_wine@foo3
@ -255,7 +255,7 @@ e@or_broken@qwerty
''@or_broken@'qwerty' ''@or_broken@'qwerty'
r@or_broken@qwerty r@or_broken@qwerty
------------ Testing variable substitution ------------ ------------ Testing variable substitution ------------
...in FOR variables --- in FOR variables
@todo_wine@"A B" @todo_wine@"A B"
C C
'A B'@or_broken@'' 'A B'@or_broken@''
@ -289,7 +289,7 @@ N
@drive@ @drive@
'' ''
'.eh' '.eh'
...in parameters --- in parameters
@todo_wine@"A B" @todo_wine@"A B"
C C
@todo_wine@'A B'@or_broken@'' @todo_wine@'A B'@or_broken@''
@ -317,12 +317,12 @@ N
'' ''
'.eh'@or_broken@'' '.eh'@or_broken@''
------------ Testing variable delayed expansion ------------ ------------ Testing variable delayed expansion ------------
...default mode (load-time expansion) --- default mode (load-time expansion)
foo foo
!FOO! !FOO!
foo foo
foo foo
...runtime (delayed) expansion mode --- runtime (delayed) expansion mode
foo foo
@todo_wine@foo@or_broken@!FOO! @todo_wine@foo@or_broken@!FOO!
foo foo
@ -331,25 +331,25 @@ foo
0@or_broken@1 0@or_broken@1
foo foo
!FOO! !FOO!
...using /V cmd flag --- using /V cmd flag
foo foo
@todo_wine@foo@or_broken@!FOO! @todo_wine@foo@or_broken@!FOO!
foo foo
!FOO! !FOO!
------------ Testing conditional execution ------------ ------------ Testing conditional execution ------------
@todo_wine@...unconditional & --- unconditional ampersand
foo1 foo1
bar2@space@ bar2@space@
foo2 foo2
foobar deleted foobar deleted
@todo_wine@...on success conditional && --- on success conditional and
@todo_wine@foo3 not created @todo_wine@foo3 not created
bar4@space@ bar4@space@
foo4 foo4
@todo_wine@...on failure conditional || --- on failure conditional or
@todo_wine@foo5 foo5
@todo_wine@foo6@space@ foo6@space@
------------ Testing cd ------------ @todo_wine@------------ Testing cd ------------
singleFile singleFile
Current dir: @pwd@\foobar@or_broken@Current dir:@space@ Current dir: @pwd@\foobar@or_broken@Current dir:@space@
@pwd@\foobar @pwd@\foobar
@ -370,10 +370,10 @@ Current dir: @pwd@\foobar@or_broken@Current dir:@space@
@pwd@>type foobaz@space@ @pwd@>type foobaz@space@
bar bar
@pwd@>echo ***@space@ @pwd@>echo ---@space@
*** ---
bar bar
*** ---
------------ Testing NUL ------------ ------------ Testing NUL ------------
bar bar
bar bar
@ -403,7 +403,7 @@ quake
quake quake
quake quake
------------ Testing for ------------ ------------ Testing for ------------
...plain FOR --- plain FOR
A A
B B
C C
@ -440,7 +440,7 @@ B'
@todo_wine@"echo A B" @todo_wine@"echo A B"
@todo_wine@"A B" @todo_wine@"A B"
C C
...imbricated FORs --- imbricated FORs
@todo_wine@X Y @todo_wine@X Y
@todo_wine@X Y @todo_wine@X Y
@todo_wine@A C @todo_wine@A C
@ -451,13 +451,13 @@ C
@todo_wine@A D @todo_wine@A D
@todo_wine@B C @todo_wine@B C
@todo_wine@B D @todo_wine@B D
...basic wildcards --- basic wildcards
bazbaz bazbaz
...for /d --- for /d
baz baz
foo foo
bar bar
...for /L --- for /L
1 1
3 3
5 5
@ -470,8 +470,8 @@ bar
-1 -1
@todo_wine@ErrorLevel 0 @todo_wine@ErrorLevel 0
@todo_wine@ErrorLevel 0 @todo_wine@ErrorLevel 0
...for /a --- for /a
......individual operations ------ individual operations
0 0
@todo_wine@3 @todo_wine@3
@todo_wine@-1 @todo_wine@-1
@ -509,7 +509,7 @@ bar
@todo_wine@4 @todo_wine@4
@todo_wine@6 @todo_wine@6
@todo_wine@1 @todo_wine@1
......precedence and grouping ------ precedence and grouping
@todo_wine@4 @todo_wine@4
@todo_wine@10 @todo_wine@10
@todo_wine@18@or_broken@10 @todo_wine@18@or_broken@10
@ -518,12 +518,12 @@ bar
0@or_broken@4 0@or_broken@4
@todo_wine@4 @todo_wine@4
@todo_wine@3@or_broken@4 @todo_wine@3@or_broken@4
......octal and hexadecimal ------ octal and hexadecimal
@todo_wine@3@or_broken@4 @todo_wine@3@or_broken@4
@todo_wine@18 @todo_wine@18
@todo_wine@18 @todo_wine@18
@todo_wine@15 @todo_wine@15
......variables ------ variables
@todo_wine@3 @todo_wine@3
@todo_wine@3@or_broken@foo not defined @todo_wine@3@or_broken@foo not defined
@todo_wine@3@or_broken@0 @todo_wine@3@or_broken@0
@ -540,26 +540,26 @@ bar
0 0
@todo_wine@5@or_broken@0 @todo_wine@5@or_broken@0
...for /F --- for /F
......string argument ------ string argument
a a
a a
a a
a a
a a
......fileset argument ------ fileset argument
.........basic blank handling --------- basic blank handling
a a
a a
a a
a a
a a
b b
.........multi-line with empty lines --------- multi-line with empty lines
a a
b b
c c
.........multiple files --------- multiple files
a a
b b
c c
@ -570,13 +570,13 @@ kkk
a a
b b
c c
......eol option ------ eol option
@todo_wine@ad @todo_wine@ad
@todo_wine@z@y @todo_wine@z@y
@todo_wine@a|d @todo_wine@a|d
@todo_wine@no output @todo_wine@no output
@todo_wine@no output @todo_wine@no output
......delims option ------ delims option
@todo_wine@a @todo_wine@a
@todo_wine@a@space@ @todo_wine@a@space@
@todo_wine@a d @todo_wine@a d
@ -584,7 +584,7 @@ c
@todo_wine@C r @todo_wine@C r
@todo_wine@foo bar baz @todo_wine@foo bar baz
@todo_wine@c:\ @todo_wine@c:\
......skip option ------ skip option
@todo_wine@c @todo_wine@c
@todo_wine@no output @todo_wine@no output
@todo_wine@no output @todo_wine@no output
@ -597,22 +597,22 @@ del /q * succeeded on file1
del /q * succeeded on file2.dat del /q * succeeded on file2.dat
------------ Testing del /s ------------ ------------ Testing del /s ------------
------------ Testing rename ------------ ------------ Testing rename ------------
... ren and rename are synonymous ... --- ren and rename are synonymous
foo renamed to bar foo renamed to bar
bar renamed to foo bar renamed to foo
... name collision ... --- name collision
foo foo
bar bar
... rename read-only files ... --- rename read-only files
read-only file renamed read-only file renamed
... rename directories ... --- rename directories
dir renamed dir renamed
read-only dir renamed read-only dir renamed
... rename in other directory ... --- rename in other directory
@todo_wine@rename impossible in other directory @todo_wine@rename impossible in other directory
@todo_wine@original file still present @todo_wine@original file still present
------------ Testing move ------------ ------------ Testing move ------------
... file move ... --- file move
file move succeeded file move succeeded
@todo_wine@file move with overwrite succeeded@or_broken@file overwrite impossible! @todo_wine@file move with overwrite succeeded@or_broken@file overwrite impossible!
@todo_wine@bar@or_broken@baz @todo_wine@bar@or_broken@baz
@ -620,21 +620,21 @@ read-only files are moveable
file moved in subdirectory file moved in subdirectory
@todo_wine@moving a file to itself is a no-op@or_broken@moving a file to itself should be a no-op! @todo_wine@moving a file to itself is a no-op@or_broken@moving a file to itself should be a no-op!
@todo_wine@ErrorLevel: 0@or_broken@ErrorLevel: 1 @todo_wine@ErrorLevel: 0@or_broken@ErrorLevel: 1
... directory move ... --- directory move
simple directory move succeeded simple directory move succeeded
moving a directory to itself gives error; errlevel 1 moving a directory to itself gives error; errlevel 1
...... dir in dir move ...... ------ dir in dir move
foo foo
bar2 bar2
foo2 foo2
------------ Testing mkdir ------------ ------------ Testing mkdir ------------
... md and mkdir are synonymous ... --- md and mkdir are synonymous
0 0
0 0
... creating an already existing directory/file must fail ... --- creating an already existing directory/file must fail
1 1
1 1
... multilevel path creation ... --- multilevel path creation
0 0
0 0
0 0
@ -643,18 +643,18 @@ foo2
1 1
0 0
0 0
... trailing backslashes ... --- trailing backslashes
0 0
dir created dir created
0 0
... invalid chars ... --- invalid chars
mkdir ? gives errorlevel 1 mkdir ? gives errorlevel 1
mkdir ?\foo gives errorlevel 1 mkdir ?\foo gives errorlevel 1
mkdir foo\? gives errorlevel 1 mkdir foo\? gives errorlevel 1
ok, foo created ok, foo created
mkdir foo\bar\? gives errorlevel 1 mkdir foo\bar\? gives errorlevel 1
ok, foo\bar created ok, foo\bar created
... multiple directories at once ... --- multiple directories at once
foo created foo created
bar created bar created
foobar created foobar created
@ -681,11 +681,11 @@ foobar removed
bar\baz removed bar\baz removed
------------ Testing pushd/popd ------------ ------------ Testing pushd/popd ------------
@pwd@ @pwd@
...popd is no-op when dir stack is empty --- popd is no-op when dir stack is empty
@pwd@ @pwd@
...pushing non-existing dir --- pushing non-existing dir
@pwd@ @pwd@
...basic behaviour --- basic behaviour
@pwd@\foobar @pwd@\foobar
@pwd@ @pwd@
@pwd@\foobar\baz @pwd@\foobar\baz
@ -696,18 +696,18 @@ bar\baz removed
@pwd@ @pwd@
------------ Testing attrib ------------ ------------ Testing attrib ------------
@todo_wine@A @pwd@\foobar\foo@or_broken@A @pwd@\foobar\foo@or_broken@A I @pwd@\foobar\foo @todo_wine@A @pwd@\foobar\foo@or_broken@A @pwd@\foobar\foo@or_broken@A I @pwd@\foobar\foo
... read-only attribute --- read-only attribute
@todo_wine@A R @pwd@\foobar\foo@or_broken@A R @pwd@\foobar\foo@or_broken@A R I @pwd@\foobar\foo @todo_wine@A R @pwd@\foobar\foo@or_broken@A R @pwd@\foobar\foo@or_broken@A R I @pwd@\foobar\foo
foo foo
foo original contents foo original contents
Read-only file not deleted Read-only file not deleted
Read-only file forcibly deleted Read-only file forcibly deleted
... recursive behaviour --- recursive behaviour
@todo_wine@A @pwd@\foobar\baz\level2@or_broken@A @pwd@\foobar\baz\level2@or_broken@A I @pwd@\foobar\baz\level2 @todo_wine@A @pwd@\foobar\baz\level2@or_broken@A @pwd@\foobar\baz\level2@or_broken@A I @pwd@\foobar\baz\level2
@todo_wine@A R @pwd@\foobar\level1@or_broken@A R @pwd@\foobar\level1@or_broken@A R I @pwd@\foobar\level1 @todo_wine@A R @pwd@\foobar\level1@or_broken@A R @pwd@\foobar\level1@or_broken@A R I @pwd@\foobar\level1
@todo_wine@A R @pwd@\foobar\baz\level2@or_broken@A R @pwd@\foobar\baz\level2@or_broken@A R I @pwd@\foobar\baz\level2 @todo_wine@A R @pwd@\foobar\baz\level2@or_broken@A R @pwd@\foobar\baz\level2@or_broken@A R I @pwd@\foobar\baz\level2
@todo_wine@A @pwd@\foobar\bar@or_broken@A @pwd@\foobar\bar@or_broken@A I @pwd@\foobar\bar @todo_wine@A @pwd@\foobar\bar@or_broken@A @pwd@\foobar\bar@or_broken@A I @pwd@\foobar\bar
... folders processing --- folders processing
@todo_wine@ @pwd@\foobar@or_broken@ @pwd@\foobar@or_broken@ I @pwd@\foobar @todo_wine@ @pwd@\foobar@or_broken@ @pwd@\foobar@or_broken@ I @pwd@\foobar
@todo_wine@ R @pwd@\foobar\baz@or_broken@ R @pwd@\foobar\baz@or_broken@ @pwd@\foobar\baz@or_broken@ R I @pwd@\foobar\baz @todo_wine@ R @pwd@\foobar\baz@or_broken@ R @pwd@\foobar\baz@or_broken@ @pwd@\foobar\baz@or_broken@ R I @pwd@\foobar\baz
@todo_wine@A @pwd@\foobar\baz\toto@or_broken@A @pwd@\foobar\baz\toto@or_broken@A I @pwd@\foobar\baz\toto @todo_wine@A @pwd@\foobar\baz\toto@or_broken@A @pwd@\foobar\baz\toto@or_broken@A I @pwd@\foobar\baz\toto
@ -715,28 +715,28 @@ toto
lulu lulu
file created in read-only dir file created in read-only dir
------------ Testing assoc ------------ ------------ Testing assoc ------------
...setting association --- setting association
*** ---
.foo=bar .foo=bar
.foo=bar .foo=bar
+++ +++
.foo=bar .foo=bar
...resetting association --- resetting association
*** ---
+++ +++
*** ---
------------ Testing ftype ------------ ------------ Testing ftype ------------
...setting association --- setting association
*** ---
footype=foo_opencmd footype=foo_opencmd
.foo=footype .foo=footype
footype=foo_opencmd footype=foo_opencmd
+++ +++
footype=foo_opencmd footype=foo_opencmd
...resetting association --- resetting association
@todo_wine@original value@or_broken@buggyXP@or_broken@!FOO! @todo_wine@original value@or_broken@buggyXP@or_broken@!FOO!
------------ Testing CALL ------------ ------------ Testing CALL ------------
... external script ... --- external script
foo@space@ foo@space@
foo 8 foo 8
foo@space@@space@ foo@space@@space@
@ -745,7 +745,7 @@ foo bar@space@
@todo_wine@"" bar@space@ @todo_wine@"" bar@space@
foo ''@space@ foo ''@space@
'' bar@space@ '' bar@space@
... internal routines ... --- internal routines
bar :testRoutine bar :testRoutine
foo@space@ foo@space@
foo bar foo bar
@ -753,7 +753,7 @@ foo bar
@todo_wine@"" bar @todo_wine@"" bar
foo '' foo ''
'' bar '' bar
... with builtins ... --- with builtins
@todo_wine@0 @todo_wine@0
@todo_wine@foo created @todo_wine@foo created
@todo_wine@Should expand foobaz @todo_wine@Should expand foobaz
@ -770,23 +770,23 @@ non-builtin dir
'p3' 'p5' '' '' '' 'p3' 'p5' '' '' ''
'p5' '' '' '' '' 'p5' '' '' '' ''
------------ Testing cmd invocation ------------ ------------ Testing cmd invocation ------------
... a batch file can delete itself ... --- a batch file can delete itself
file correctly deleted file correctly deleted
... a batch file can alter itself ... --- a batch file can alter itself
@todo_wine@bar @todo_wine@bar
------------ Testing setlocal/endlocal ------------ ------------ Testing setlocal/endlocal ------------
...enable/disable extensions --- enable/disable extensions
@todo_wine@ErrLev:@space@ @todo_wine@ErrLev:@space@
ErrLev: 0 ErrLev: 0
ErrLev: 0 ErrLev: 0
@todo_wine@ErrLev:@space@@or_broken@ErrLev: 0 @todo_wine@ErrLev:@space@@or_broken@ErrLev: 0
ErrLev: 0 ErrLev: 0
...setlocal with corresponding endlocal --- setlocal with corresponding endlocal
globalval globalval
localval localval
globalval globalval
globalval globalval
...setlocal with no corresponding endlocal --- setlocal with no corresponding endlocal
globalval globalval
localval localval
@todo_wine@globalval @todo_wine@globalval