2010-02-09 19:11:15 +01:00
|
|
|
|
2010-11-05 22:15:45 +01:00
|
|
|
@pwd@>echo Tests for cmd's builtin commands@space@
|
2010-02-16 20:42:18 +01:00
|
|
|
Tests for cmd's builtin commands
|
2010-11-05 22:15:45 +01:00
|
|
|
|
|
|
|
@pwd@>echo ------------ Testing 'echo' [ON] --------------@space@
|
|
|
|
------------ Testing 'echo' [ON] --------------
|
|
|
|
|
|
|
|
@pwd@>echo word@space@
|
|
|
|
word
|
|
|
|
|
|
|
|
@pwd@>echo 'singlequotedword'@space@
|
|
|
|
'singlequotedword'
|
|
|
|
|
|
|
|
@pwd@>echo "doublequotedword"@space@
|
|
|
|
"doublequotedword"
|
|
|
|
at-echoed-word
|
|
|
|
|
|
|
|
@pwd@>echo "/?"@space@
|
|
|
|
"/?"
|
|
|
|
|
2011-08-05 16:29:21 +02:00
|
|
|
@pwd@>echo.
|
2010-11-05 22:15:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
@pwd@>echo .@space@
|
|
|
|
.
|
|
|
|
|
2011-08-05 16:29:21 +02:00
|
|
|
@pwd@>echo.word
|
2010-11-05 22:15:45 +01:00
|
|
|
word
|
|
|
|
|
|
|
|
@pwd@>echo .word@space@
|
|
|
|
.word
|
|
|
|
|
2011-08-05 16:29:21 +02:00
|
|
|
@pwd@>echo:
|
2011-07-28 01:06:47 +02:00
|
|
|
|
2011-07-28 01:06:46 +02:00
|
|
|
|
|
|
|
@pwd@>echo :@space@
|
|
|
|
:
|
|
|
|
|
2011-08-05 16:29:21 +02:00
|
|
|
@pwd@>echo:word
|
2011-07-28 01:06:47 +02:00
|
|
|
word
|
2011-07-28 01:06:46 +02:00
|
|
|
|
|
|
|
@pwd@>echo :word@space@
|
|
|
|
:word
|
|
|
|
|
2010-11-05 22:15:45 +01:00
|
|
|
@pwd@>echo word@space@@space@
|
|
|
|
word@space@
|
|
|
|
|
|
|
|
@pwd@>echo word@space@@space@@space@
|
|
|
|
word@space@@space@
|
2011-08-20 01:26:55 +02:00
|
|
|
|
|
|
|
@todo_wine@@pwd@>echo word@space@
|
|
|
|
word
|
|
|
|
|
|
|
|
@pwd@>echo@tab@word@space@
|
|
|
|
@todo_wine@word
|
|
|
|
|
|
|
|
@pwd@>echo@tab@word@space@@tab@@space@
|
|
|
|
@todo_wine@word@space@@tab@
|
|
|
|
|
|
|
|
@pwd@>echo@tab@word@tab@@space@@space@
|
|
|
|
@todo_wine@word@tab@@space@
|
|
|
|
|
|
|
|
@todo_wine@@pwd@>echo word@space@
|
|
|
|
word
|
|
|
|
|
|
|
|
@pwd@>echo@space@@tab@word@space@
|
|
|
|
@tab@word
|
|
|
|
|
|
|
|
@pwd@>echo@space@@space@@tab@word@space@
|
|
|
|
@space@@tab@word
|
|
|
|
|
|
|
|
@pwd@>echo@tab@@tab@word@space@
|
|
|
|
@todo_wine@@tab@word
|
2010-11-05 22:15:45 +01:00
|
|
|
------------ Testing 'echo' [OFF] --------------
|
2010-02-09 19:11:15 +01:00
|
|
|
word
|
|
|
|
'singlequotedword'
|
|
|
|
"doublequotedword"
|
|
|
|
at-echoed-word
|
|
|
|
"/?"
|
|
|
|
|
|
|
|
.
|
2010-09-08 00:59:43 +02:00
|
|
|
word
|
|
|
|
.word
|
2011-07-28 01:06:47 +02:00
|
|
|
|
2011-07-28 01:06:46 +02:00
|
|
|
:
|
2011-07-28 01:06:47 +02:00
|
|
|
word
|
2011-07-28 01:06:46 +02:00
|
|
|
:word
|
2010-11-05 22:15:45 +01:00
|
|
|
word@space@
|
|
|
|
word@space@@space@
|
2011-08-20 01:26:55 +02:00
|
|
|
word
|
|
|
|
@todo_wine@word
|
|
|
|
@todo_wine@word@space@@tab@
|
|
|
|
@todo_wine@word@tab@@space@
|
|
|
|
word
|
|
|
|
@tab@word
|
|
|
|
@space@@tab@word
|
|
|
|
@todo_wine@@tab@word
|
2011-07-26 21:32:07 +02:00
|
|
|
------------ Testing redirection operators --------------
|
|
|
|
...stdout redirection
|
|
|
|
foo
|
|
|
|
foo@space@
|
|
|
|
@todo_wine@foo1
|
|
|
|
@todo_wine@foo11
|
|
|
|
@todo_wine@foo12
|
|
|
|
...stdout appending
|
|
|
|
foo
|
|
|
|
foo@space@
|
|
|
|
foob@space@
|
|
|
|
foob@space@
|
|
|
|
fooc@space@
|
|
|
|
foob@space@
|
|
|
|
fooc@space@
|
|
|
|
@todo_wine@food1
|
|
|
|
@todo_wine@foob@space@
|
|
|
|
@todo_wine@fooc@space@
|
|
|
|
@todo_wine@food1
|
|
|
|
@todo_wine@food2
|
|
|
|
@todo_wine@food21
|
2011-07-23 20:13:50 +02:00
|
|
|
@todo_wine@------------ Testing ^ escape character --------------
|
|
|
|
@todo_wine@hello, world
|
|
|
|
@todo_wine@hello, world
|
|
|
|
@todo_wine@hell^o, world
|
|
|
|
@todo_wine@hell^o, world
|
|
|
|
baz
|
|
|
|
@todo_wine@baz
|
|
|
|
@todo_wine@foo | echo bar
|
|
|
|
@todo_wine@foo & echo bar
|
|
|
|
@todo_wine@bak &
|
|
|
|
@todo_wine@baz@space@
|
|
|
|
@todo_wine@0@or_broken@1
|
|
|
|
@todo_wine@foo > foo
|
|
|
|
@todo_wine@<
|
|
|
|
@todo_wine@ffoof
|
|
|
|
@todo_wine@FOO=bar | baz
|
|
|
|
@todo_wine@0
|
|
|
|
@todo_wine@FOO=bar ^| baz
|
|
|
|
@todo_wine@bar | baz
|
|
|
|
@todo_wine@0
|
2010-02-16 21:25:41 +01:00
|
|
|
------------ Testing 'set' --------------
|
2011-07-17 22:48:56 +02:00
|
|
|
1
|
|
|
|
@todo_wine@0
|
|
|
|
FOOBAR not defined
|
|
|
|
@todo_wine@ baz
|
|
|
|
FOOBAR = baz
|
|
|
|
@todo_wine@0
|
|
|
|
@todo_wine@ baz2
|
|
|
|
@todo_wine@0
|
|
|
|
bar
|
|
|
|
@todo_wine@FOOBAR= bar
|
|
|
|
@todo_wine@FOOBAR = baz2
|
2011-07-28 01:06:45 +02:00
|
|
|
FOOBAR = baz2
|
2011-07-17 22:48:56 +02:00
|
|
|
FOOBAR not defined
|
|
|
|
1
|
|
|
|
bar
|
|
|
|
foobar
|
|
|
|
FOO not defined
|
|
|
|
BAZ=bazbaz
|
|
|
|
bazbaz
|
2010-02-16 21:25:41 +01:00
|
|
|
set "FOO=bar" should not include the quotes in the variable value
|
|
|
|
bar
|
2011-08-20 01:26:55 +02:00
|
|
|
@todo_wine@foo
|
|
|
|
@todo_wine@''
|
|
|
|
'foo@space@'
|
|
|
|
'foo@tab@'
|
2010-02-16 21:44:16 +01:00
|
|
|
------------ Testing variable expansion --------------
|
|
|
|
~dp0 should be directory containing batch file
|
|
|
|
@pwd@\
|
|
|
|
@pwd@\
|
2011-07-28 01:06:45 +02:00
|
|
|
CD value @pwd@@or_broken@CD value@space@
|
2010-03-09 13:15:35 +01:00
|
|
|
%
|
|
|
|
P
|
|
|
|
P
|
|
|
|
S
|
|
|
|
P
|
|
|
|
PS
|
|
|
|
ERRORLEVEL
|
|
|
|
0
|
|
|
|
00
|
2010-03-16 10:54:26 +01:00
|
|
|
0ERRORLEVEL
|
2010-03-09 13:15:35 +01:00
|
|
|
0
|
|
|
|
0%
|
|
|
|
P0
|
|
|
|
0S
|
|
|
|
P0S
|
2011-08-01 11:46:53 +02:00
|
|
|
------------ 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!
|
2011-08-02 10:10:52 +02:00
|
|
|
...using /V cmd flag
|
|
|
|
foo
|
|
|
|
@todo_wine@foo@or_broken@!FOO!
|
|
|
|
foo
|
|
|
|
!FOO!
|
2011-07-23 15:34:20 +02:00
|
|
|
------------ Testing conditional execution --------------
|
|
|
|
@todo_wine@...unconditional &
|
|
|
|
foo1
|
|
|
|
bar2@space@
|
|
|
|
foo2
|
|
|
|
@todo_wine@foobar deleted
|
2011-07-23 15:34:21 +02:00
|
|
|
@todo_wine@...on success conditional &&
|
|
|
|
@todo_wine@foo3 not created
|
|
|
|
bar4@space@
|
|
|
|
foo4
|
2011-07-23 15:34:22 +02:00
|
|
|
@todo_wine@...on failure conditional ||
|
|
|
|
@todo_wine@foo5
|
|
|
|
@todo_wine@foo6@space@
|
2011-08-20 01:59:00 +02:00
|
|
|
------------ Testing cd ------------
|
|
|
|
singleFile
|
|
|
|
Current dir: @pwd@\foobar@or_broken@Current dir:@space@
|
|
|
|
@pwd@\foobar
|
|
|
|
@pwd@
|
|
|
|
@pwd@\foobar
|
|
|
|
@pwd@
|
|
|
|
@pwd@\foobar
|
|
|
|
@pwd@
|
|
|
|
@todo_wine@@pwd@
|
2011-08-20 01:26:55 +02:00
|
|
|
@todo_wine@@pwd@
|
|
|
|
@pwd@\foobar\bar bak
|
2011-08-20 01:59:00 +02:00
|
|
|
@pwd@\foobar\bar bak
|
|
|
|
@pwd@\foobar\bar bak
|
|
|
|
@pwd@
|
2011-07-14 20:07:14 +02:00
|
|
|
------------ Testing type ------------
|
|
|
|
|
|
|
|
@pwd@>type foobaz@space@
|
|
|
|
bar
|
|
|
|
|
|
|
|
@pwd@>echo ***@space@
|
|
|
|
***
|
|
|
|
bar
|
|
|
|
***
|
2011-07-19 09:49:24 +02:00
|
|
|
------------ Testing NUL ------------
|
|
|
|
bar
|
|
|
|
bar
|
|
|
|
bar
|
|
|
|
NUL
|
|
|
|
@todo_wine@foo created
|
2010-02-18 08:11:04 +01:00
|
|
|
------------ Testing if/else --------------
|
|
|
|
if/else should work with blocks
|
|
|
|
if seems to work
|
|
|
|
else seems to work
|
2011-07-11 23:07:03 +02:00
|
|
|
@todo_wine@if seems not to detect /c as parameter
|
2010-02-19 06:39:32 +01:00
|
|
|
Testing case sensitivity with and without /i option
|
|
|
|
if seems to default to case sensitivity
|
|
|
|
if /i seems to work
|
|
|
|
if /I seems to work
|
2011-07-11 23:34:05 +02:00
|
|
|
-----------Testing for -----------
|
2011-07-28 01:06:48 +02:00
|
|
|
...plain FOR
|
2011-07-11 23:34:05 +02:00
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
2011-07-28 01:06:48 +02:00
|
|
|
%I
|
|
|
|
%I
|
|
|
|
%I
|
|
|
|
%j
|
|
|
|
%j
|
|
|
|
%j
|
2011-07-11 23:34:05 +02:00
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
2011-07-28 01:06:48 +02:00
|
|
|
1
|
|
|
|
4
|
|
|
|
1
|
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
2011-08-20 01:58:57 +02:00
|
|
|
X
|
2011-08-20 01:26:55 +02:00
|
|
|
@todo_wine@X2
|
|
|
|
@todo_wine@X3
|
|
|
|
foo
|
|
|
|
@todo_wine@M
|
|
|
|
@todo_wine@X
|
2011-07-28 01:06:48 +02:00
|
|
|
...imbricated FORs
|
|
|
|
@todo_wine@X Y
|
2011-07-11 23:34:05 +02:00
|
|
|
@todo_wine@X Y
|
|
|
|
@todo_wine@A C
|
|
|
|
@todo_wine@A D
|
|
|
|
@todo_wine@B C
|
|
|
|
@todo_wine@B D
|
|
|
|
@todo_wine@A C
|
|
|
|
@todo_wine@A D
|
|
|
|
@todo_wine@B C
|
|
|
|
@todo_wine@B D
|
2011-07-28 01:06:48 +02:00
|
|
|
...basic wildcards
|
|
|
|
bazbaz
|
2011-07-29 13:59:50 +02:00
|
|
|
...for /d
|
|
|
|
baz
|
|
|
|
foo
|
|
|
|
bar
|
2011-07-29 13:59:52 +02:00
|
|
|
...for /L
|
|
|
|
1
|
|
|
|
3
|
|
|
|
5
|
|
|
|
1
|
|
|
|
3
|
|
|
|
5
|
|
|
|
0
|
|
|
|
2
|
|
|
|
1
|
|
|
|
-1
|
|
|
|
@todo_wine@ErrorLevel 0
|
|
|
|
@todo_wine@ErrorLevel 0
|
2011-08-04 16:01:48 +02:00
|
|
|
...for /a
|
|
|
|
......individual operations
|
|
|
|
0
|
|
|
|
@todo_wine@3
|
|
|
|
@todo_wine@-1
|
|
|
|
@todo_wine@3
|
|
|
|
@todo_wine@6
|
|
|
|
@todo_wine@10
|
|
|
|
@todo_wine@4
|
|
|
|
@todo_wine@4
|
|
|
|
@todo_wine@-4
|
|
|
|
0
|
|
|
|
@todo_wine@2
|
|
|
|
@todo_wine@2
|
|
|
|
@todo_wine@-2
|
|
|
|
@todo_wine@1
|
|
|
|
@todo_wine@4
|
|
|
|
0@or_broken@1073741824
|
|
|
|
0@or_broken@-1073741824
|
|
|
|
@todo_wine@-4
|
|
|
|
@todo_wine@9
|
|
|
|
@todo_wine@2
|
|
|
|
0
|
|
|
|
@todo_wine@-1
|
|
|
|
@todo_wine@-3
|
|
|
|
0
|
|
|
|
@todo_wine@1
|
|
|
|
@todo_wine@1
|
|
|
|
@todo_wine@4
|
|
|
|
@todo_wine@1
|
|
|
|
@todo_wine@5
|
|
|
|
@todo_wine@5
|
|
|
|
@todo_wine@7
|
|
|
|
@todo_wine@5
|
|
|
|
@todo_wine@5
|
|
|
|
@todo_wine@5
|
|
|
|
@todo_wine@4
|
|
|
|
@todo_wine@6
|
|
|
|
@todo_wine@1
|
|
|
|
......precedence and grouping
|
|
|
|
@todo_wine@4
|
|
|
|
@todo_wine@10
|
|
|
|
@todo_wine@18@or_broken@10
|
|
|
|
@todo_wine@2@or_broken@0
|
|
|
|
@todo_wine@2@or_broken@0
|
|
|
|
0@or_broken@4
|
|
|
|
@todo_wine@4
|
|
|
|
@todo_wine@3@or_broken@4
|
|
|
|
......octal and hexadecimal
|
|
|
|
@todo_wine@3@or_broken@4
|
|
|
|
@todo_wine@18
|
|
|
|
@todo_wine@18
|
|
|
|
@todo_wine@15
|
|
|
|
......variables
|
|
|
|
@todo_wine@3
|
|
|
|
@todo_wine@3@or_broken@foo not defined
|
|
|
|
@todo_wine@3@or_broken@0
|
|
|
|
@todo_wine@3@or_broken@0
|
|
|
|
@todo_wine@3@or_broken@0
|
|
|
|
@todo_wine@9@or_broken@0
|
|
|
|
0
|
|
|
|
@todo_wine@4@or_broken@0
|
|
|
|
@todo_wine@-7@or_broken@0
|
|
|
|
@todo_wine@-1@or_broken@0
|
|
|
|
@todo_wine@5@or_broken@0
|
|
|
|
@todo_wine@4@or_broken@0
|
|
|
|
@todo_wine@1@or_broken@0
|
|
|
|
0
|
|
|
|
@todo_wine@5@or_broken@0
|
|
|
|
|
2011-05-22 17:27:38 +02:00
|
|
|
-----------Testing del /a-----------
|
|
|
|
not-r.test not found after delete, good
|
|
|
|
r.test found before delete, good
|
|
|
|
r.test not found after delete, good
|
2011-05-30 05:19:00 +02:00
|
|
|
------------ Testing del /q --------------
|
|
|
|
del /q * succeeded on file1
|
|
|
|
del /q * succeeded on file2.dat
|
2011-06-02 04:12:56 +02:00
|
|
|
------------ Testing del /s --------------
|
2011-07-11 23:34:06 +02:00
|
|
|
----------- Testing mkdir -----------
|
|
|
|
0
|
|
|
|
0
|
2011-08-02 21:35:36 +02:00
|
|
|
1
|
|
|
|
1
|
2011-07-11 23:34:06 +02:00
|
|
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
0
|
2011-08-02 21:35:36 +02:00
|
|
|
1
|
2011-07-11 23:34:06 +02:00
|
|
|
0
|
|
|
|
0
|
2011-07-11 23:34:07 +02:00
|
|
|
0
|
|
|
|
dir created
|
|
|
|
0
|
2011-08-02 21:21:31 +02:00
|
|
|
mkdir ? gives errorlevel 1
|
|
|
|
mkdir ?\foo gives errorlevel 1
|
|
|
|
mkdir foo\? gives errorlevel 1
|
2011-08-02 21:35:36 +02:00
|
|
|
ok, foo created
|
2011-08-02 21:21:31 +02:00
|
|
|
mkdir foo\bar\? gives errorlevel 1
|
2011-08-02 21:35:36 +02:00
|
|
|
ok, foo\bar created
|
2011-07-24 22:11:35 +02:00
|
|
|
foo created
|
2011-08-02 22:02:19 +02:00
|
|
|
bar created
|
|
|
|
foobar created
|
|
|
|
bar\baz created
|
2011-08-02 21:35:36 +02:00
|
|
|
mkdir foo\* errorlevel 1
|
|
|
|
ok, foo created
|
2011-07-11 23:34:08 +02:00
|
|
|
----------- Testing rmdir -----------
|
|
|
|
0
|
|
|
|
dir removed
|
|
|
|
0
|
|
|
|
dir removed
|
|
|
|
0
|
|
|
|
0
|
|
|
|
file not removed
|
|
|
|
0
|
|
|
|
non-empty dir not removed
|
|
|
|
0
|
|
|
|
non-empty dir not removed
|
2011-07-19 09:49:25 +02:00
|
|
|
recursive rmdir succeeded
|
|
|
|
recursive rmdir succeeded
|
2011-07-24 22:11:36 +02:00
|
|
|
foo removed
|
|
|
|
bar removed
|
|
|
|
foobar removed
|
|
|
|
bar\baz removed
|
2011-07-21 15:28:26 +02:00
|
|
|
------------ Testing CALL --------------
|
2011-07-28 01:06:45 +02:00
|
|
|
foo@space@
|
|
|
|
@todo_wine@foo 8
|
2011-07-29 13:59:51 +02:00
|
|
|
foo@space@@space@
|
|
|
|
foo bar@space@
|
|
|
|
@todo_wine@foo ""@space@
|
|
|
|
@todo_wine@"" bar@space@
|
|
|
|
foo ''@space@
|
|
|
|
'' bar@space@
|
2011-07-21 15:28:26 +02:00
|
|
|
bar :testRoutine
|
2011-07-29 13:59:51 +02:00
|
|
|
foo@space@
|
|
|
|
foo bar
|
|
|
|
@todo_wine@foo ""
|
|
|
|
@todo_wine@"" bar
|
|
|
|
foo ''
|
|
|
|
'' bar
|
2011-07-21 15:28:26 +02:00
|
|
|
@todo_wine@0
|
|
|
|
@todo_wine@foo created
|
|
|
|
@todo_wine@Should expand foobaz
|
|
|
|
@todo_wine@batfile
|
|
|
|
@todo_wine@robinfile
|
|
|
|
@todo_wine@1
|
|
|
|
@todo_wine@1
|
|
|
|
non-builtin dir
|
2011-08-04 11:50:47 +02:00
|
|
|
------------ 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
|
2011-05-26 06:42:37 +02:00
|
|
|
-----------Testing Errorlevel-----------
|
2011-07-19 09:49:26 +02:00
|
|
|
9009
|
2011-05-26 06:42:37 +02:00
|
|
|
1
|
|
|
|
errorlevel just right, good
|
|
|
|
abc0def@or_broken@abc1def
|
|
|
|
errorlevel zero, good@or_broken@errorlevel nonzero, bad
|
|
|
|
7 should be 7
|
|
|
|
7 should still be 7
|
2010-03-24 04:45:49 +01:00
|
|
|
-----------Testing GOTO-----------
|
|
|
|
goto with no leading space worked
|
|
|
|
goto with a leading space worked
|
|
|
|
goto with a leading tab worked
|
2010-12-13 00:04:19 +01:00
|
|
|
goto with a following space worked
|
2011-05-26 06:42:37 +02:00
|
|
|
-----------Done, jumping to EOF-----------
|