Commit 128d0656 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

cmd/tests: Standardize the batch file section headers.

parent 81f64ee9
echo Tests for cmd's builtin commands echo Tests for cmd's builtin commands
@echo on @echo on
echo ------------ Testing 'echo' [ON] -------------- echo ------------ Testing 'echo' [ON] ------------
echo word echo word
echo 'singlequotedword' echo 'singlequotedword'
echo "doublequotedword" echo "doublequotedword"
...@@ -30,7 +30,7 @@ echo @tab@ on @space@ ...@@ -30,7 +30,7 @@ echo @tab@ on @space@
@echo off @echo off
echo off@tab@@space@ echo off@tab@@space@
echo ------------ Testing 'echo' [OFF] -------------- echo ------------ Testing 'echo' [OFF] ------------
echo word echo word
echo 'singlequotedword' echo 'singlequotedword'
echo "doublequotedword" echo "doublequotedword"
...@@ -56,7 +56,7 @@ echo @tab@word ...@@ -56,7 +56,7 @@ echo @tab@word
echo @tab@word echo @tab@word
echo@tab@@tab@word echo@tab@@tab@word
echo ------------ Testing mixed echo modes -------------- echo ------------ Testing mixed echo modes ------------
echo @echo on> mixedEchoModes.cmd echo @echo on> mixedEchoModes.cmd
echo if 1==1 echo foo>> mixedEchoModes.cmd echo if 1==1 echo foo>> mixedEchoModes.cmd
echo if 1==1 @echo bar>> mixedEchoModes.cmd echo if 1==1 @echo bar>> mixedEchoModes.cmd
...@@ -67,7 +67,7 @@ type mixedEchoModes.cmd ...@@ -67,7 +67,7 @@ type mixedEchoModes.cmd
cmd /c mixedEchoModes.cmd cmd /c mixedEchoModes.cmd
del mixedEchoModes.cmd del mixedEchoModes.cmd
echo ------------ Testing rem -------------- echo ------------ Testing rem ------------
rem Hello rem Hello
rem Hello rem Hello
rem Hello || foo rem Hello || foo
...@@ -87,7 +87,7 @@ rem@tab@ Hello ...@@ -87,7 +87,7 @@ rem@tab@ Hello
rem@tab@echo foo & echo bar rem@tab@echo foo & echo bar
@echo off @echo off
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
...@@ -164,7 +164,7 @@ type C ...@@ -164,7 +164,7 @@ type C
(if 1==0 (echo A > B) else echo C) (if 1==0 (echo A > B) else echo C)
cd .. & rd /s/q foobar cd .. & rd /s/q foobar
echo ------------ Testing circumflex escape character -------------- echo ------------ Testing circumflex escape character ------------
rem Using something like "echo foo^" asks for an additional char after a "More?" prompt on the following line; it's not possible to currently test that non-interactively rem Using something like "echo foo^" asks for an additional char after a "More?" prompt on the following line; it's not possible to currently test that non-interactively
echo ^hell^o, world echo ^hell^o, world
echo hell^o, world echo hell^o, world
...@@ -198,7 +198,7 @@ echo %FOO% ...@@ -198,7 +198,7 @@ echo %FOO%
echo %ErrorLevel% echo %ErrorLevel%
set FOO= set FOO=
echo ------------ Testing 'set' -------------- echo ------------ Testing 'set' ------------
call :setError 0 call :setError 0
set FOOBAR 2> nul > nul set FOOBAR 2> nul > nul
echo %ErrorLevel% echo %ErrorLevel%
...@@ -246,7 +246,7 @@ set FOO=foo@tab@ ...@@ -246,7 +246,7 @@ set FOO=foo@tab@
echo '%FOO%' echo '%FOO%'
set FOO= set FOO=
echo ------------ Testing variable expansion -------------- echo ------------ Testing variable expansion ------------
call :setError 0 call :setError 0
echo ~dp0 should be directory containing batch file echo ~dp0 should be directory containing batch file
echo %~dp0 echo %~dp0
...@@ -272,7 +272,7 @@ echo P%ERRORLEVEL% ...@@ -272,7 +272,7 @@ echo P%ERRORLEVEL%
echo %ERRORLEVEL%S echo %ERRORLEVEL%S
echo P%ERRORLEVEL%S echo P%ERRORLEVEL%S
echo ------------ Testing variable substrings -------------- echo ------------ Testing variable substrings ------------
set VAR=qwerty set VAR=qwerty
echo %VAR:~0,1% echo %VAR:~0,1%
echo %VAR:~0,3% echo %VAR:~0,3%
...@@ -285,7 +285,7 @@ echo '%VAR:~-2,-4%' ...@@ -285,7 +285,7 @@ echo '%VAR:~-2,-4%'
echo %VAR:~-3,-2% 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
...@@ -395,7 +395,7 @@ echo '%~xs1' ...@@ -395,7 +395,7 @@ echo '%~xs1'
goto :eof goto :eof
:endEchoFuns :endEchoFuns
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
...@@ -444,7 +444,7 @@ cmd /V:ON /C tmp.cmd ...@@ -444,7 +444,7 @@ cmd /V:ON /C tmp.cmd
cmd /V:OfF /C tmp.cmd cmd /V:OfF /C tmp.cmd
del tmp.cmd del tmp.cmd
echo ------------ Testing conditional execution -------------- echo ------------ Testing conditional execution ------------
echo ...unconditional ^& echo ...unconditional ^&
call :setError 123 & echo foo1 call :setError 123 & echo foo1
echo bar2 & echo foo2 echo bar2 & echo foo2
...@@ -554,7 +554,7 @@ if exist foo ( ...@@ -554,7 +554,7 @@ if exist foo (
) )
cd .. & rd foobar cd .. & rd foobar
echo ------------ Testing if/else -------------- echo ------------ Testing if/else ------------
echo if/else should work with blocks echo if/else should work with blocks
if 0 == 0 ( if 0 == 0 (
echo if seems to work echo if seems to work
...@@ -592,7 +592,7 @@ if 1==0@tab@(echo doom) else echo quake ...@@ -592,7 +592,7 @@ if 1==0@tab@(echo doom) else echo quake
if 1==0 (echo doom)@tab@else echo quake 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
...@@ -831,7 +831,7 @@ if not exist output_file (echo no output) else (del output_file) ...@@ -831,7 +831,7 @@ if not exist output_file (echo no output) else (del output_file)
cd .. cd ..
rd /s/q foobar rd /s/q foobar
echo -----------Testing del /a----------- echo ------------ Testing del /a ------------
del /f/q *.test > nul del /f/q *.test > nul
echo r > r.test echo r > r.test
attrib +r r.test attrib +r r.test
...@@ -847,7 +847,7 @@ del /a:r *.test ...@@ -847,7 +847,7 @@ del /a:r *.test
if not exist r.test echo r.test not found after delete, good if not exist r.test echo r.test not found after delete, good
if exist r.test echo r.test found after delete, bad if exist r.test echo r.test found after delete, bad
echo ------------ Testing del /q -------------- echo ------------ Testing del /q ------------
mkdir del_q_dir mkdir del_q_dir
cd del_q_dir cd del_q_dir
echo abc > file1 echo abc > file1
...@@ -859,7 +859,7 @@ for %%a in (1 2.dat) do if not exist file%%a echo del /q * succeeded on file%%a ...@@ -859,7 +859,7 @@ for %%a in (1 2.dat) do if not exist file%%a echo del /q * succeeded on file%%a
cd .. cd ..
rmdir del_q_dir rmdir del_q_dir
echo ------------ Testing del /s -------------- echo ------------ Testing del /s ------------
mkdir "foo bar" mkdir "foo bar"
cd "foo bar" cd "foo bar"
mkdir "foo:" mkdir "foo:"
...@@ -1107,7 +1107,7 @@ echo mkdir foo\* errorlevel %ErrorLevel% ...@@ -1107,7 +1107,7 @@ echo mkdir foo\* errorlevel %ErrorLevel%
if exist foo (rmdir foo & echo ok, foo created if exist foo (rmdir foo & echo ok, foo created
) else ( echo bad, foo not created ) ) else ( echo bad, foo not created )
echo ----------- Testing rmdir ----------- echo ------------ Testing rmdir ------------
call :setError 0 call :setError 0
rem rd and rmdir are synonymous rem rd and rmdir are synonymous
mkdir foobar mkdir foobar
...@@ -1172,7 +1172,7 @@ if not exist foobar (echo foobar removed) else echo foobar not removed! ...@@ -1172,7 +1172,7 @@ if not exist foobar (echo foobar removed) else echo foobar not removed!
if not exist bar\baz (echo bar\baz removed) else echo bar\baz not removed! if not exist bar\baz (echo bar\baz removed) else echo bar\baz not removed!
cd .. & rd /s/q foobaz 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
...@@ -1205,7 +1205,7 @@ popd ...@@ -1205,7 +1205,7 @@ popd
cd cd
rd /s/q foobar rd /s/q foobar
echo ------------ Testing attrib -------------- echo ------------ Testing attrib ------------
rem FIXME Add tests for archive, hidden and system attributes + mixed attributes modifications rem FIXME Add tests for archive, hidden and system attributes + mixed attributes modifications
mkdir foobar & cd foobar mkdir foobar & cd foobar
echo foo original contents> foo echo foo original contents> foo
...@@ -1263,7 +1263,7 @@ rem Oddly windows allows file creation in a read-only directory... ...@@ -1263,7 +1263,7 @@ rem Oddly windows allows file creation in a read-only directory...
if exist baz\lala (echo file created in read-only dir) else echo file not created if exist baz\lala (echo file created in read-only dir) else echo file not created
cd .. & rd /s/q foobar cd .. & rd /s/q foobar
echo ------------ Testing assoc -------------- 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
...@@ -1293,7 +1293,7 @@ type baz ...@@ -1293,7 +1293,7 @@ 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
...@@ -1477,7 +1477,7 @@ echo %VAR% ...@@ -1477,7 +1477,7 @@ echo %VAR%
set VAR= set VAR=
cd .. & rd /q/s foobar cd .. & rd /q/s foobar
echo -----------Testing Errorlevel----------- echo ------------ Testing Errorlevel ------------
rem WARNING: Do *not* add tests using ErrorLevel after this section rem WARNING: Do *not* add tests using ErrorLevel after this section
should_not_exist 2> nul > nul should_not_exist 2> nul > nul
echo %ErrorLevel% echo %ErrorLevel%
...@@ -1504,7 +1504,7 @@ if errorlevel 7 echo setting var worked too well, bad ...@@ -1504,7 +1504,7 @@ if errorlevel 7 echo setting var worked too well, bad
call :setError 3 call :setError 3
echo %ErrorLevel% should still be 7 echo %ErrorLevel% should still be 7
echo -----------Testing GOTO----------- echo ------------ Testing GOTO ------------
if a==a goto dest1 if a==a goto dest1
:dest1 :dest1
echo goto with no leading space worked echo goto with no leading space worked
...@@ -1518,7 +1518,7 @@ if d==d goto dest4 ...@@ -1518,7 +1518,7 @@ if d==d goto dest4
:dest4@space@ :dest4@space@
echo goto with a following space worked echo goto with a following space worked
echo ---------- Testing combined CALLs/GOTOs ----------- echo ------------ Testing combined CALLs/GOTOs ------------
echo @echo off>foo.cmd echo @echo off>foo.cmd
echo goto :eof>>foot.cmd echo goto :eof>>foot.cmd
echo :eof>>foot.cmd echo :eof>>foot.cmd
...@@ -1565,7 +1565,7 @@ goto :eof ...@@ -1565,7 +1565,7 @@ goto :eof
echo Final message is not output since earlier 'foot' processing stops script execution echo Final message is not output since earlier 'foot' processing stops script execution
echo Do NOT add any tests below this line echo Do NOT add any tests below this line
echo -----------Done, jumping to EOF----------- echo ------------ Done, jumping to EOF -----------
goto :eof goto :eof
rem Subroutine to set errorlevel and return rem Subroutine to set errorlevel and return
rem in windows nt 4.0, this always sets errorlevel 1, since /b isn't supported rem in windows nt 4.0, this always sets errorlevel 1, since /b isn't supported
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
@pwd@>echo Tests for cmd's builtin commands@space@ @pwd@>echo Tests for cmd's builtin commands@space@
Tests for cmd's builtin commands Tests for cmd's builtin commands
@pwd@>echo ------------ Testing 'echo' [ON] --------------@space@ @pwd@>echo ------------ Testing 'echo' [ON] ------------@space@
------------ Testing 'echo' [ON] -------------- ------------ Testing 'echo' [ON] ------------
@pwd@>echo word@space@ @pwd@>echo word@space@
word word
...@@ -76,7 +76,7 @@ word ...@@ -76,7 +76,7 @@ word
@tab@word @tab@word
@pwd@>echo @tab@ on @space@@space@ @pwd@>echo @tab@ on @space@@space@
------------ Testing 'echo' [OFF] -------------- ------------ Testing 'echo' [OFF] ------------
word word
'singlequotedword' 'singlequotedword'
"doublequotedword" "doublequotedword"
...@@ -101,7 +101,7 @@ word ...@@ -101,7 +101,7 @@ word
@tab@word @tab@word
@space@@tab@word @space@@tab@word
@tab@word @tab@word
------------ Testing mixed echo modes -------------- ------------ Testing mixed echo modes ------------
@echo on @echo on
if 1==1 echo foo if 1==1 echo foo
if 1==1 @echo bar if 1==1 @echo bar
...@@ -116,7 +116,7 @@ foo ...@@ -116,7 +116,7 @@ foo
bar bar
foo2 foo2
bar2 bar2
------------ Testing rem -------------- ------------ Testing rem ------------
@pwd@>rem Hello@space@ @pwd@>rem Hello@space@
...@@ -133,7 +133,7 @@ bar2 ...@@ -133,7 +133,7 @@ bar2
@pwd@>rem@tab@ Hello@space@ @pwd@>rem@tab@ Hello@space@
@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@
...@@ -178,7 +178,7 @@ foo ...@@ -178,7 +178,7 @@ foo
A A
B B
C C
------------ Testing circumflex escape character -------------- ------------ Testing circumflex escape character ------------
@todo_wine@hello, world @todo_wine@hello, world
@todo_wine@hello, world @todo_wine@hello, world
@todo_wine@hell^o, world @todo_wine@hell^o, world
...@@ -198,7 +198,7 @@ baz ...@@ -198,7 +198,7 @@ baz
@todo_wine@FOO=bar ^| baz @todo_wine@FOO=bar ^| baz
@todo_wine@bar | baz @todo_wine@bar | baz
@todo_wine@0 @todo_wine@0
------------ Testing 'set' -------------- ------------ Testing 'set' ------------
1 1
@todo_wine@0 @todo_wine@0
FOOBAR not defined FOOBAR not defined
...@@ -224,7 +224,7 @@ foo ...@@ -224,7 +224,7 @@ foo
'' ''
'foo@space@' 'foo@space@'
'foo@tab@' 'foo@tab@'
------------ Testing variable expansion -------------- ------------ Testing variable expansion ------------
~dp0 should be directory containing batch file ~dp0 should be directory containing batch file
@pwd@\ @pwd@\
@pwd@\ @pwd@\
...@@ -244,7 +244,7 @@ ERRORLEVEL ...@@ -244,7 +244,7 @@ ERRORLEVEL
P0 P0
0S 0S
P0S P0S
------------ Testing variable substrings -------------- ------------ Testing variable substrings ------------
q q
qwe qwe
er er
...@@ -254,7 +254,7 @@ ert@or_broken@qwerty ...@@ -254,7 +254,7 @@ ert@or_broken@qwerty
e@or_broken@qwerty 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
...@@ -316,7 +316,7 @@ N ...@@ -316,7 +316,7 @@ N
@drive@ @drive@
'' ''
'.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!
...@@ -336,7 +336,7 @@ foo ...@@ -336,7 +336,7 @@ 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 & @todo_wine@...unconditional &
foo1 foo1
bar2@space@ bar2@space@
...@@ -380,7 +380,7 @@ bar ...@@ -380,7 +380,7 @@ bar
bar bar
NUL NUL
@todo_wine@foo created @todo_wine@foo created
------------ Testing if/else -------------- ------------ Testing if/else ------------
if/else should work with blocks if/else should work with blocks
if seems to work if seems to work
else seems to work else seems to work
...@@ -402,7 +402,7 @@ lol ...@@ -402,7 +402,7 @@ lol
quake quake
quake quake
quake quake
-----------Testing for ----------- ------------ Testing for ------------
...plain FOR ...plain FOR
A A
B B
...@@ -588,14 +588,14 @@ c ...@@ -588,14 +588,14 @@ c
@todo_wine@c @todo_wine@c
@todo_wine@no output @todo_wine@no output
@todo_wine@no output @todo_wine@no output
-----------Testing del /a----------- ------------ Testing del /a ------------
not-r.test not found after delete, good not-r.test not found after delete, good
r.test found before delete, good r.test found before delete, good
r.test not found after delete, good r.test not found after delete, good
------------ Testing del /q -------------- ------------ Testing del /q ------------
del /q * succeeded on file1 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
...@@ -661,7 +661,7 @@ foobar created ...@@ -661,7 +661,7 @@ foobar created
bar\baz created bar\baz created
mkdir foo\* errorlevel 1 mkdir foo\* errorlevel 1
ok, foo created ok, foo created
----------- Testing rmdir ----------- ------------ Testing rmdir ------------
0 0
dir removed dir removed
0 0
...@@ -679,7 +679,7 @@ foo removed ...@@ -679,7 +679,7 @@ foo removed
bar removed bar removed
foobar removed 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@
...@@ -694,7 +694,7 @@ bar\baz removed ...@@ -694,7 +694,7 @@ bar\baz removed
@pwd@ @pwd@
@pwd@\foobar @pwd@\foobar
@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
...@@ -714,7 +714,7 @@ Read-only file forcibly deleted ...@@ -714,7 +714,7 @@ Read-only file forcibly deleted
toto 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
...@@ -725,7 +725,7 @@ file created in read-only dir ...@@ -725,7 +725,7 @@ file created in read-only dir
*** ***
+++ +++
*** ***
------------ Testing ftype -------------- ------------ Testing ftype ------------
...setting association ...setting association
*** ***
footype=foo_opencmd footype=foo_opencmd
...@@ -790,7 +790,7 @@ globalval ...@@ -790,7 +790,7 @@ globalval
globalval globalval
localval localval
@todo_wine@globalval @todo_wine@globalval
-----------Testing Errorlevel----------- ------------ Testing Errorlevel ------------
9009 9009
1 1
errorlevel just right, good errorlevel just right, good
...@@ -800,12 +800,12 @@ abc0def@or_broken@abc1def ...@@ -800,12 +800,12 @@ abc0def@or_broken@abc1def
errorlevel zero, good@or_broken@errorlevel nonzero, bad errorlevel zero, good@or_broken@errorlevel nonzero, bad
7 should be 7 7 should be 7
7 should still be 7 7 should still be 7
-----------Testing GOTO----------- ------------ Testing GOTO ------------
goto with no leading space worked goto with no leading space worked
goto with a leading space worked goto with a leading space worked
goto with a leading tab worked goto with a leading tab worked
goto with a following space worked goto with a following space worked
---------- Testing combined CALLs/GOTOs ----------- ------------ Testing combined CALLs/GOTOs ------------
world world
cheball cheball
barbare barbare
......
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