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
|
|
|
|
2011-11-29 11:45:51 +01:00
|
|
|
@pwd@>echo ------------ Testing 'echo' [ON] ------------@space@
|
|
|
|
------------ Testing 'echo' [ON] ------------
|
2010-11-05 22:15:45 +01:00
|
|
|
|
|
|
|
@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
|
|
|
|
|
2011-08-25 00:48:24 +02:00
|
|
|
@pwd@>echo off now@space@
|
|
|
|
off now
|
|
|
|
|
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
|
|
|
|
2012-09-25 23:05:03 +02:00
|
|
|
@pwd@>echo word@space@
|
2011-08-20 01:26:55 +02:00
|
|
|
word
|
|
|
|
|
|
|
|
@pwd@>echo@tab@word@space@
|
2011-08-23 22:54:49 +02:00
|
|
|
word
|
2011-08-20 01:26:55 +02:00
|
|
|
|
|
|
|
@pwd@>echo@tab@word@space@@tab@@space@
|
2011-08-23 22:54:49 +02:00
|
|
|
word@space@@tab@
|
2011-08-20 01:26:55 +02:00
|
|
|
|
|
|
|
@pwd@>echo@tab@word@tab@@space@@space@
|
2011-08-23 22:54:49 +02:00
|
|
|
word@tab@@space@
|
2011-08-20 01:26:55 +02:00
|
|
|
|
2012-09-25 23:05:03 +02:00
|
|
|
@pwd@>echo word@space@
|
2011-08-20 01:26:55 +02:00
|
|
|
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@
|
2011-08-23 22:54:49 +02:00
|
|
|
@tab@word
|
2011-11-11 19:27:43 +01:00
|
|
|
|
|
|
|
@pwd@>echo @tab@ on @space@@space@
|
2012-09-25 23:05:03 +02:00
|
|
|
noecho1
|
|
|
|
noecho2
|
|
|
|
echo3
|
2011-11-29 11:45:51 +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
|
2011-08-25 00:48:24 +02:00
|
|
|
on again
|
2010-11-05 22:15:45 +01:00
|
|
|
word@space@
|
|
|
|
word@space@@space@
|
2011-08-20 01:26:55 +02:00
|
|
|
word
|
2011-08-23 22:54:49 +02:00
|
|
|
word
|
|
|
|
word@space@@tab@
|
|
|
|
word@tab@@space@
|
2011-08-20 01:26:55 +02:00
|
|
|
word
|
|
|
|
@tab@word
|
|
|
|
@space@@tab@word
|
2011-08-23 22:54:49 +02:00
|
|
|
@tab@word
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing mixed echo modes ------------
|
2011-08-27 02:11:33 +02:00
|
|
|
@echo on
|
|
|
|
if 1==1 echo foo
|
|
|
|
if 1==1 @echo bar
|
|
|
|
@echo off
|
|
|
|
if 1==1 echo foo2
|
|
|
|
if 1==1 @echo bar2
|
|
|
|
|
|
|
|
@todo_wine@@pwd@>if 1 == 1 echo foo@space@
|
|
|
|
foo
|
|
|
|
|
|
|
|
@todo_wine@@pwd@>if 1 == 1@space@
|
|
|
|
bar
|
|
|
|
foo2
|
|
|
|
bar2
|
2012-09-26 01:07:20 +02:00
|
|
|
------------ Testing parameterization ------------
|
|
|
|
'a', 'b', 'c'
|
|
|
|
'"a b c"', '', ''
|
|
|
|
'"a b"\c', '', ''
|
|
|
|
'a', '~`+', '.{}!+b'
|
|
|
|
'a', 'b', ''
|
|
|
|
'"a;b"', '', ''
|
2012-09-25 14:45:28 +02:00
|
|
|
'a', 'b', ''
|
2012-09-26 01:07:20 +02:00
|
|
|
'a[b]{c}(d)e', '', ''
|
|
|
|
'a', '', ''
|
|
|
|
second line
|
|
|
|
'a', 'b', 'c'
|
|
|
|
'a', 'b', 'c'
|
|
|
|
'a', 'b', ''
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing rem ------------
|
2011-08-25 00:48:20 +02:00
|
|
|
|
|
|
|
@pwd@>rem Hello@space@
|
|
|
|
|
|
|
|
@pwd@>rem Hello@space@
|
|
|
|
|
|
|
|
@pwd@>rem Hello || foo@space@
|
|
|
|
|
|
|
|
@pwd@>rem echo lol@space@
|
|
|
|
|
|
|
|
@pwd@>rem echo foo & echo bar@space@
|
2011-08-25 00:48:21 +02:00
|
|
|
|
|
|
|
@pwd@>rem @tab@ Hello@space@
|
|
|
|
|
|
|
|
@pwd@>rem@tab@ Hello@space@
|
|
|
|
|
|
|
|
@pwd@>rem@tab@echo foo & echo bar@space@
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing redirection operators ------------
|
2011-11-29 11:46:16 +01:00
|
|
|
--- stdout redirection
|
2011-07-26 21:32:07 +02:00
|
|
|
foo
|
|
|
|
foo@space@
|
2011-08-27 02:11:30 +02:00
|
|
|
foo@tab@
|
|
|
|
foo@space@
|
|
|
|
foo@tab@
|
|
|
|
foo7@space@@or_broken@foo@tab@
|
|
|
|
foo9@space@@or_broken@foo@tab@
|
|
|
|
foo1
|
|
|
|
foo11
|
|
|
|
foo12
|
2012-09-26 01:07:20 +02:00
|
|
|
foo13
|
|
|
|
foo14
|
|
|
|
foo15
|
2011-11-29 11:46:16 +01:00
|
|
|
--- stdout appending
|
2011-07-26 21:32:07 +02:00
|
|
|
foo
|
|
|
|
foo@space@
|
|
|
|
foob@space@
|
|
|
|
foob@space@
|
|
|
|
fooc@space@
|
|
|
|
foob@space@
|
|
|
|
fooc@space@
|
2011-08-27 02:11:30 +02:00
|
|
|
food1
|
|
|
|
foob@space@
|
|
|
|
fooc@space@
|
|
|
|
food1
|
|
|
|
food2
|
|
|
|
food21
|
2011-08-27 02:11:29 +02:00
|
|
|
@todo_wine@foo7@space@@space@@or_broken@not supported@space@
|
|
|
|
@todo_wine@foo@or_broken@not supported
|
2011-11-29 11:46:16 +01:00
|
|
|
--- redirections within IF statements
|
2011-08-27 02:11:32 +02:00
|
|
|
@todo_wine@foo1
|
2011-11-30 13:05:29 +01:00
|
|
|
-----
|
|
|
|
foo2
|
|
|
|
foo3
|
2011-12-02 10:07:27 +01:00
|
|
|
file does not exist, ok
|
2011-08-27 02:11:32 +02:00
|
|
|
foo4
|
|
|
|
baz5
|
|
|
|
baz6@space@
|
|
|
|
baz7
|
|
|
|
baz8
|
|
|
|
baz
|
|
|
|
foo@space@
|
|
|
|
baz
|
|
|
|
foo
|
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing circumflex escape character ------------
|
2012-09-25 14:45:28 +02:00
|
|
|
hello, world
|
|
|
|
hello, world
|
|
|
|
hell^o, world
|
|
|
|
hell^o, world
|
2012-09-25 22:02:09 +02:00
|
|
|
helloworld
|
|
|
|
hello
|
|
|
|
world
|
|
|
|
hello
|
|
|
|
|
|
|
|
finished
|
2012-09-25 14:45:28 +02:00
|
|
|
baz
|
2011-07-23 20:13:50 +02:00
|
|
|
baz
|
2012-09-25 14:45:28 +02:00
|
|
|
foo | echo bar
|
|
|
|
foo & echo bar
|
|
|
|
bak &
|
2011-12-02 10:07:27 +01:00
|
|
|
baz@space@
|
|
|
|
0@or_broken@1
|
2012-09-25 14:45:28 +02:00
|
|
|
foo > foo
|
|
|
|
<
|
|
|
|
ffoof
|
|
|
|
FOO=bar | baz
|
|
|
|
0
|
|
|
|
FOO=bar ^| baz
|
|
|
|
bar | baz
|
|
|
|
0
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing 'set' ------------
|
2011-07-17 22:48:56 +02:00
|
|
|
1
|
2012-09-06 00:41:48 +02:00
|
|
|
0
|
2011-07-17 22:48:56 +02:00
|
|
|
FOOBAR not defined
|
2012-09-06 01:09:23 +02:00
|
|
|
baz
|
2011-07-17 22:48:56 +02:00
|
|
|
FOOBAR = baz
|
2012-09-06 00:41:48 +02:00
|
|
|
0
|
2012-09-06 01:09:23 +02:00
|
|
|
baz2
|
2012-09-06 00:41:48 +02:00
|
|
|
0
|
2011-07-17 22:48:56 +02:00
|
|
|
bar
|
2012-09-26 00:16:54 +02:00
|
|
|
FOOBAR= bar
|
|
|
|
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-25 00:48:19 +02:00
|
|
|
foo
|
|
|
|
''
|
2011-08-20 01:26:55 +02:00
|
|
|
'foo@space@'
|
|
|
|
'foo@tab@'
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing variable expansion ------------
|
2010-02-16 21:44:16 +01:00
|
|
|
~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-11-29 11:45:51 +01:00
|
|
|
------------ Testing variable substrings ------------
|
2011-08-25 14:22:29 +02:00
|
|
|
q
|
|
|
|
qwe
|
|
|
|
er
|
|
|
|
@todo_wine@'ty'@or_broken@''
|
|
|
|
't'@or_broken@''
|
|
|
|
ert@or_broken@qwerty
|
|
|
|
e@or_broken@qwerty
|
|
|
|
''@or_broken@'qwerty'
|
|
|
|
r@or_broken@qwerty
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing variable substitution ------------
|
2011-11-29 11:46:16 +01:00
|
|
|
--- in FOR variables
|
2012-09-26 01:07:20 +02:00
|
|
|
"A B"
|
2011-08-26 01:19:28 +02:00
|
|
|
C
|
2012-09-25 23:05:03 +02:00
|
|
|
"A B"
|
|
|
|
C
|
2011-08-26 01:19:28 +02:00
|
|
|
'A B'@or_broken@''
|
|
|
|
'C'@or_broken@''
|
|
|
|
@pwd@\C D@or_broken@%~ff
|
|
|
|
@pwd@\E@or_broken@%~ff
|
|
|
|
@drive@
|
|
|
|
@drive@
|
|
|
|
@path@@or_broken@%~pd
|
|
|
|
@path@@or_broken@%~pd
|
|
|
|
L M
|
|
|
|
N
|
|
|
|
'.OOL'
|
|
|
|
'.TABC'
|
|
|
|
''
|
|
|
|
@todo_wine@'@drive@@shortpath@R S'@or_broken@''
|
|
|
|
@todo_wine@'@drive@@shortpath@T'@or_broken@''
|
|
|
|
@todo_wine@'@drive@@shortpath@ABCDEFGHIJK.LMNOP'@or_broken@''
|
|
|
|
@todo_wine@''@or_broken@'%~ai'
|
|
|
|
@todo_wine@''@or_broken@'%~ai'
|
|
|
|
@todo_wine@'--a------'@or_broken@'%~ai'
|
|
|
|
@todo_wine@''@or_broken@'%~ti'
|
|
|
|
@todo_wine@''@or_broken@'%~ti'
|
|
|
|
@todo_wine@''@or_broken@'%~zi'
|
|
|
|
@todo_wine@''@or_broken@'%~zi'
|
|
|
|
@drive@@path@
|
|
|
|
@drive@@path@
|
|
|
|
@drive@
|
|
|
|
@drive@
|
|
|
|
@drive@
|
|
|
|
@drive@
|
|
|
|
''
|
|
|
|
'.eh'
|
2011-11-29 11:46:16 +01:00
|
|
|
--- in parameters
|
2012-09-26 01:07:20 +02:00
|
|
|
"A B"
|
2011-08-26 01:19:28 +02:00
|
|
|
C
|
2012-09-26 01:07:20 +02:00
|
|
|
'A B'@or_broken@''
|
2011-08-26 01:19:28 +02:00
|
|
|
'C'@or_broken@''
|
2012-09-26 01:07:20 +02:00
|
|
|
@pwd@\C D
|
2011-08-26 01:19:28 +02:00
|
|
|
@pwd@\E
|
|
|
|
@drive@
|
|
|
|
@drive@
|
|
|
|
@path@
|
|
|
|
@path@
|
2012-09-26 01:07:20 +02:00
|
|
|
L M
|
2011-08-26 01:19:28 +02:00
|
|
|
N
|
2012-09-26 01:07:20 +02:00
|
|
|
'.OOL'
|
2011-08-26 01:19:28 +02:00
|
|
|
'.TABC'
|
|
|
|
''
|
|
|
|
@todo_wine@'@drive@@shortpath@R S'@or_broken@''
|
|
|
|
@todo_wine@'@drive@@shortpath@T'@or_broken@''
|
|
|
|
@todo_wine@'@drive@@shortpath@ABCDEFGHIJK.LMNOP'@or_broken@''
|
|
|
|
@drive@@path@
|
|
|
|
@drive@@path@
|
|
|
|
@drive@
|
|
|
|
@drive@
|
|
|
|
@drive@
|
|
|
|
@drive@
|
|
|
|
''
|
|
|
|
'.eh'@or_broken@''
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing variable delayed expansion ------------
|
2011-11-29 11:46:16 +01:00
|
|
|
--- default mode (load-time expansion)
|
2011-08-01 11:46:53 +02:00
|
|
|
foo
|
|
|
|
!FOO!
|
|
|
|
foo
|
|
|
|
foo
|
2011-11-29 11:46:16 +01:00
|
|
|
--- runtime (delayed) expansion mode
|
2011-08-01 11:46:53 +02:00
|
|
|
foo
|
|
|
|
@todo_wine@foo@or_broken@!FOO!
|
|
|
|
foo
|
|
|
|
@todo_wine@bar@or_broken@foo
|
|
|
|
0
|
|
|
|
0@or_broken@1
|
|
|
|
foo
|
|
|
|
!FOO!
|
2011-11-29 11:46:16 +01:00
|
|
|
--- using /V cmd flag
|
2011-08-02 10:10:52 +02:00
|
|
|
foo
|
|
|
|
@todo_wine@foo@or_broken@!FOO!
|
|
|
|
foo
|
|
|
|
!FOO!
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing conditional execution ------------
|
2011-11-29 11:46:16 +01:00
|
|
|
--- unconditional ampersand
|
2011-07-23 15:34:20 +02:00
|
|
|
foo1
|
|
|
|
bar2@space@
|
|
|
|
foo2
|
2011-08-27 02:11:28 +02:00
|
|
|
foobar deleted
|
2011-11-29 11:46:16 +01:00
|
|
|
--- on success conditional and
|
2011-07-23 15:34:21 +02:00
|
|
|
@todo_wine@foo3 not created
|
|
|
|
bar4@space@
|
|
|
|
foo4
|
2011-11-29 11:46:16 +01:00
|
|
|
--- on failure conditional or
|
|
|
|
foo5
|
|
|
|
foo6@space@
|
|
|
|
@todo_wine@------------ Testing cd ------------
|
2011-08-20 01:59:00 +02:00
|
|
|
singleFile
|
|
|
|
Current dir: @pwd@\foobar@or_broken@Current dir:@space@
|
|
|
|
@pwd@\foobar
|
|
|
|
@pwd@
|
|
|
|
@pwd@\foobar
|
|
|
|
@pwd@
|
|
|
|
@pwd@\foobar
|
|
|
|
@pwd@
|
2011-08-27 02:11:28 +02:00
|
|
|
@pwd@
|
|
|
|
@pwd@
|
2011-08-20 01:26:55 +02:00
|
|
|
@pwd@\foobar\bar bak
|
2011-08-20 01:59:00 +02:00
|
|
|
@pwd@\foobar\bar bak
|
|
|
|
@pwd@\foobar\bar bak
|
2012-09-26 01:07:20 +02:00
|
|
|
@pwd@\foobar\bar bak
|
|
|
|
@pwd@\foobar\bar bak
|
2011-08-20 01:59:00 +02:00
|
|
|
@pwd@
|
2011-08-25 00:48:23 +02:00
|
|
|
@pwd@\foobar
|
2011-07-14 20:07:14 +02:00
|
|
|
------------ Testing type ------------
|
|
|
|
|
|
|
|
@pwd@>type foobaz@space@
|
|
|
|
bar
|
|
|
|
|
2011-11-29 11:46:16 +01:00
|
|
|
@pwd@>echo ---@space@
|
|
|
|
---
|
2011-07-14 20:07:14 +02:00
|
|
|
bar
|
2012-09-26 01:07:20 +02:00
|
|
|
---1
|
|
|
|
bar
|
|
|
|
---2
|
|
|
|
bar
|
|
|
|
---3
|
2011-07-19 09:49:24 +02:00
|
|
|
------------ Testing NUL ------------
|
|
|
|
bar
|
|
|
|
bar
|
|
|
|
bar
|
|
|
|
NUL
|
|
|
|
@todo_wine@foo created
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing if/else ------------
|
2010-02-18 08:11:04 +01:00
|
|
|
if/else should work with blocks
|
|
|
|
if seems to work
|
|
|
|
else seems to work
|
2011-09-06 19:19:44 +02:00
|
|
|
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-09-04 16:33:29 +02:00
|
|
|
Testing string comparisons
|
|
|
|
equal
|
2011-09-06 19:19:44 +02:00
|
|
|
non equal
|
|
|
|
non equal
|
2011-09-04 16:33:29 +02:00
|
|
|
equal
|
|
|
|
Testing tabs handling
|
2011-08-25 00:48:22 +02:00
|
|
|
doom
|
|
|
|
doom
|
|
|
|
doom
|
|
|
|
lol
|
|
|
|
quake
|
|
|
|
quake
|
|
|
|
quake
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing for ------------
|
2011-11-29 11:46:16 +01: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-23 22:54:50 +02:00
|
|
|
X2
|
|
|
|
X3
|
2011-08-20 01:26:55 +02:00
|
|
|
foo
|
2011-08-23 22:54:50 +02:00
|
|
|
M
|
|
|
|
X
|
|
|
|
M
|
|
|
|
N
|
|
|
|
O
|
2011-08-25 23:08:31 +02:00
|
|
|
`echo
|
|
|
|
A
|
|
|
|
B`
|
|
|
|
'echo
|
|
|
|
A
|
|
|
|
B'
|
2012-09-26 01:07:20 +02:00
|
|
|
"echo A B"
|
|
|
|
"A B"
|
2011-08-25 23:08:31 +02:00
|
|
|
C
|
2011-11-29 11:46:16 +01:00
|
|
|
--- imbricated FORs
|
2011-07-28 01:06:48 +02:00
|
|
|
@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-11-29 11:46:16 +01:00
|
|
|
--- basic wildcards
|
2011-07-28 01:06:48 +02:00
|
|
|
bazbaz
|
2011-11-29 11:46:16 +01:00
|
|
|
--- for /d
|
2012-09-04 22:11:51 +02:00
|
|
|
baz@space@
|
|
|
|
foo@space@
|
|
|
|
bar@space@
|
|
|
|
PASSED
|
|
|
|
xxx - Should be xxx
|
|
|
|
Expected second line
|
2011-11-29 11:46:16 +01:00
|
|
|
--- for /L
|
2011-07-29 13:59:52 +02:00
|
|
|
1
|
|
|
|
3
|
|
|
|
5
|
|
|
|
1
|
|
|
|
3
|
|
|
|
5
|
|
|
|
0
|
|
|
|
2
|
|
|
|
1
|
|
|
|
-1
|
2012-09-03 00:25:21 +02:00
|
|
|
ErrorLevel 0
|
|
|
|
ErrorLevel 0
|
2012-09-02 23:08:57 +02:00
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
1
|
|
|
|
3
|
|
|
|
4
|
|
|
|
3
|
|
|
|
2
|
|
|
|
1
|
|
|
|
4
|
|
|
|
2
|
|
|
|
0
|
|
|
|
1
|
|
|
|
1
|
|
|
|
-1
|
|
|
|
-1
|
|
|
|
1
|
|
|
|
3
|
2011-11-29 11:46:16 +01:00
|
|
|
--- for /a
|
|
|
|
------ individual operations
|
2011-08-04 16:01:48 +02:00
|
|
|
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
|
2011-11-29 11:46:16 +01:00
|
|
|
------ precedence and grouping
|
2011-08-04 16:01:48 +02:00
|
|
|
@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
|
2011-11-29 11:46:16 +01:00
|
|
|
------ octal and hexadecimal
|
2011-08-04 16:01:48 +02:00
|
|
|
@todo_wine@3@or_broken@4
|
|
|
|
@todo_wine@18
|
|
|
|
@todo_wine@18
|
|
|
|
@todo_wine@15
|
2011-11-29 11:46:16 +01:00
|
|
|
------ variables
|
2011-08-04 16:01:48 +02:00
|
|
|
@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-11-29 11:46:16 +01:00
|
|
|
--- for /F
|
|
|
|
------ string argument
|
2012-09-26 01:07:20 +02:00
|
|
|
@todo_wine@a
|
|
|
|
@todo_wine@a
|
2011-08-25 23:08:32 +02:00
|
|
|
a
|
2012-09-26 01:07:20 +02:00
|
|
|
@todo_wine@a
|
|
|
|
@todo_wine@a
|
2011-11-29 11:46:16 +01:00
|
|
|
------ fileset argument
|
|
|
|
--------- basic blank handling
|
2011-08-25 23:08:32 +02:00
|
|
|
a
|
|
|
|
a
|
|
|
|
a
|
|
|
|
a
|
|
|
|
a
|
|
|
|
b
|
2011-11-29 11:46:16 +01:00
|
|
|
--------- multi-line with empty lines
|
2011-08-25 23:08:32 +02:00
|
|
|
a
|
|
|
|
b
|
|
|
|
c
|
2011-11-29 11:46:16 +01:00
|
|
|
--------- multiple files
|
2011-08-25 23:08:32 +02:00
|
|
|
a
|
|
|
|
b
|
|
|
|
c
|
|
|
|
q
|
|
|
|
kkk
|
|
|
|
q
|
|
|
|
kkk
|
|
|
|
a
|
|
|
|
b
|
|
|
|
c
|
2011-11-29 11:46:16 +01:00
|
|
|
------ eol option
|
2011-08-25 23:08:33 +02:00
|
|
|
@todo_wine@ad
|
|
|
|
@todo_wine@z@y
|
|
|
|
@todo_wine@a|d
|
|
|
|
@todo_wine@no output
|
|
|
|
@todo_wine@no output
|
2011-11-29 11:46:16 +01:00
|
|
|
------ delims option
|
2011-08-25 23:08:34 +02:00
|
|
|
@todo_wine@a
|
|
|
|
@todo_wine@a@space@
|
|
|
|
@todo_wine@a d
|
|
|
|
@todo_wine@a
|
|
|
|
@todo_wine@C r
|
|
|
|
@todo_wine@foo bar baz
|
|
|
|
@todo_wine@c:\
|
2011-11-29 11:46:16 +01:00
|
|
|
------ skip option
|
2011-08-25 23:08:35 +02:00
|
|
|
@todo_wine@c
|
|
|
|
@todo_wine@no output
|
|
|
|
@todo_wine@no output
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing del /a ------------
|
2011-05-22 17:27:38 +02:00
|
|
|
not-r.test not found after delete, good
|
|
|
|
r.test found before delete, good
|
|
|
|
r.test not found after delete, good
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing del /q ------------
|
2011-05-30 05:19:00 +02:00
|
|
|
del /q * succeeded on file1
|
|
|
|
del /q * succeeded on file2.dat
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing del /s ------------
|
2011-09-14 23:39:10 +02:00
|
|
|
------------ Testing rename ------------
|
2011-11-29 11:46:16 +01:00
|
|
|
--- ren and rename are synonymous
|
2011-09-14 23:39:10 +02:00
|
|
|
foo renamed to bar
|
|
|
|
bar renamed to foo
|
2011-11-29 11:46:16 +01:00
|
|
|
--- name collision
|
2011-09-14 23:39:10 +02:00
|
|
|
foo
|
|
|
|
bar
|
2011-11-29 11:46:16 +01:00
|
|
|
--- rename read-only files
|
2011-10-14 15:37:59 +02:00
|
|
|
read-only file renamed
|
2011-11-29 11:46:16 +01:00
|
|
|
--- rename directories
|
2011-10-14 15:37:57 +02:00
|
|
|
dir renamed
|
|
|
|
read-only dir renamed
|
2011-11-29 11:46:16 +01:00
|
|
|
--- rename in other directory
|
2012-09-03 23:48:08 +02:00
|
|
|
rename impossible in other directory
|
|
|
|
original file still present
|
2011-10-11 19:04:31 +02:00
|
|
|
------------ Testing move ------------
|
2011-11-29 11:46:16 +01:00
|
|
|
--- file move
|
2011-10-11 19:04:31 +02:00
|
|
|
file move succeeded
|
|
|
|
@todo_wine@file move with overwrite succeeded@or_broken@file overwrite impossible!
|
|
|
|
@todo_wine@bar@or_broken@baz
|
2011-10-13 17:30:17 +02:00
|
|
|
read-only files are moveable
|
2011-10-11 19:04:31 +02:00
|
|
|
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@ErrorLevel: 0@or_broken@ErrorLevel: 1
|
2011-11-29 11:46:16 +01:00
|
|
|
--- directory move
|
2011-10-11 19:04:31 +02:00
|
|
|
simple directory move succeeded
|
|
|
|
moving a directory to itself gives error; errlevel 1
|
2011-11-29 11:46:16 +01:00
|
|
|
------ dir in dir move
|
2011-10-11 19:04:31 +02:00
|
|
|
foo
|
|
|
|
bar2
|
|
|
|
foo2
|
2011-09-14 23:39:10 +02:00
|
|
|
------------ Testing mkdir ------------
|
2011-11-29 11:46:16 +01:00
|
|
|
--- md and mkdir are synonymous
|
2011-07-11 23:34:06 +02:00
|
|
|
0
|
|
|
|
0
|
2011-11-29 11:46:16 +01:00
|
|
|
--- creating an already existing directory/file must fail
|
2011-08-02 21:35:36 +02:00
|
|
|
1
|
|
|
|
1
|
2011-11-29 11:46:16 +01:00
|
|
|
--- multilevel path creation
|
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-11-29 11:46:16 +01:00
|
|
|
--- trailing backslashes
|
2011-07-11 23:34:07 +02:00
|
|
|
0
|
|
|
|
dir created
|
|
|
|
0
|
2011-11-29 11:46:16 +01:00
|
|
|
--- invalid chars
|
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-11-29 11:46:16 +01:00
|
|
|
--- multiple directories at once
|
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
|
2012-09-26 01:07:20 +02:00
|
|
|
bazbaz created
|
|
|
|
zabzab created
|
2011-08-02 21:35:36 +02:00
|
|
|
mkdir foo\* errorlevel 1
|
|
|
|
ok, foo created
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing rmdir ------------
|
2011-07-11 23:34:08 +02:00
|
|
|
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-11-29 11:45:51 +01:00
|
|
|
------------ Testing pushd/popd ------------
|
2011-08-30 23:33:52 +02:00
|
|
|
@pwd@
|
2011-11-29 11:46:16 +01:00
|
|
|
--- popd is no-op when dir stack is empty
|
2011-08-30 23:33:52 +02:00
|
|
|
@pwd@
|
2011-11-29 11:46:16 +01:00
|
|
|
--- pushing non-existing dir
|
2011-08-30 23:33:52 +02:00
|
|
|
@pwd@
|
2011-11-29 11:46:16 +01:00
|
|
|
--- basic behaviour
|
2011-08-30 23:33:52 +02:00
|
|
|
@pwd@\foobar
|
|
|
|
@pwd@
|
|
|
|
@pwd@\foobar\baz
|
|
|
|
@pwd@\foobar
|
|
|
|
@pwd@\foobar
|
|
|
|
@pwd@
|
|
|
|
@pwd@\foobar
|
|
|
|
@pwd@
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing attrib ------------
|
2012-03-26 22:06:17 +02:00
|
|
|
A @pwd@\foobar\foo@or_broken@A @pwd@\foobar\foo@or_broken@A I @pwd@\foobar\foo
|
2011-11-29 11:46:16 +01:00
|
|
|
--- read-only attribute
|
2012-03-26 22:06:17 +02:00
|
|
|
A R @pwd@\foobar\foo@or_broken@A R @pwd@\foobar\foo@or_broken@A R I @pwd@\foobar\foo
|
2011-08-24 12:53:21 +02:00
|
|
|
foo
|
|
|
|
foo original contents
|
|
|
|
Read-only file not deleted
|
|
|
|
Read-only file forcibly deleted
|
2011-11-29 11:46:16 +01:00
|
|
|
--- recursive behaviour
|
2011-08-26 01:09:50 +02:00
|
|
|
@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\baz\level2@or_broken@A R @pwd@\foobar\baz\level2@or_broken@A R I @pwd@\foobar\baz\level2
|
2012-03-26 22:06:17 +02:00
|
|
|
A @pwd@\foobar\bar@or_broken@A @pwd@\foobar\bar@or_broken@A I @pwd@\foobar\bar
|
2011-11-29 11:46:16 +01:00
|
|
|
--- folders processing
|
2012-03-26 22:06:01 +02:00
|
|
|
@pwd@\foobar@or_broken@ @pwd@\foobar@or_broken@ I @pwd@\foobar
|
2011-08-26 01:09:50 +02:00
|
|
|
@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
|
2011-08-24 12:53:21 +02:00
|
|
|
toto
|
|
|
|
lulu
|
|
|
|
file created in read-only dir
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing assoc ------------
|
2011-11-29 11:46:16 +01:00
|
|
|
--- setting association
|
|
|
|
---
|
2011-08-29 21:45:16 +02:00
|
|
|
.foo=bar
|
2011-08-29 21:45:17 +02:00
|
|
|
.foo=bar
|
2011-08-29 21:45:16 +02:00
|
|
|
+++
|
2011-08-29 21:45:17 +02:00
|
|
|
.foo=bar
|
2011-11-29 11:46:16 +01:00
|
|
|
--- resetting association
|
|
|
|
---
|
2011-08-29 21:45:16 +02:00
|
|
|
+++
|
2011-11-29 11:46:16 +01:00
|
|
|
---
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing ftype ------------
|
2011-11-29 11:46:16 +01:00
|
|
|
--- setting association
|
|
|
|
---
|
2011-08-29 21:45:19 +02:00
|
|
|
footype=foo_opencmd
|
|
|
|
.foo=footype
|
|
|
|
footype=foo_opencmd
|
|
|
|
+++
|
|
|
|
footype=foo_opencmd
|
2011-11-29 11:46:16 +01:00
|
|
|
--- resetting association
|
2011-08-29 21:45:19 +02:00
|
|
|
@todo_wine@original value@or_broken@buggyXP@or_broken@!FOO!
|
2011-09-11 16:54:08 +02:00
|
|
|
------------ Testing CALL ------------
|
2011-11-29 11:46:16 +01:00
|
|
|
--- external script
|
2011-07-28 01:06:45 +02:00
|
|
|
foo@space@
|
2011-08-27 02:11:30 +02:00
|
|
|
foo 8
|
2011-07-29 13:59:51 +02:00
|
|
|
foo@space@@space@
|
|
|
|
foo bar@space@
|
2012-09-26 01:07:20 +02:00
|
|
|
foo ""@space@
|
|
|
|
"" bar@space@
|
2011-07-29 13:59:51 +02:00
|
|
|
foo ''@space@
|
|
|
|
'' bar@space@
|
2011-11-29 11:46:16 +01:00
|
|
|
--- internal routines
|
2011-07-21 15:28:26 +02:00
|
|
|
bar :testRoutine
|
2011-07-29 13:59:51 +02:00
|
|
|
foo@space@
|
|
|
|
foo bar
|
2012-09-26 01:07:20 +02:00
|
|
|
foo ""
|
|
|
|
"" bar
|
2011-07-29 13:59:51 +02:00
|
|
|
foo ''
|
|
|
|
'' bar
|
2011-11-29 11:46:16 +01:00
|
|
|
--- with builtins
|
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-09-13 12:06:45 +02:00
|
|
|
------------ Testing SHIFT ------------
|
|
|
|
'p1' 'p2' 'p3' 'p4' 'p5'
|
|
|
|
'p2' 'p3' 'p4' 'p5' ''
|
|
|
|
'p3' 'p4' 'p5' '' ''
|
|
|
|
'p3' 'p5' '' '' ''
|
|
|
|
'p3' 'p5' '' '' ''
|
|
|
|
'p5' '' '' '' ''
|
2011-09-11 17:14:54 +02:00
|
|
|
------------ Testing cmd invocation ------------
|
2011-11-29 11:46:16 +01:00
|
|
|
--- a batch file can delete itself
|
2011-09-11 17:14:55 +02:00
|
|
|
file correctly deleted
|
2011-11-29 11:46:16 +01:00
|
|
|
--- a batch file can alter itself
|
2011-09-11 17:14:54 +02:00
|
|
|
@todo_wine@bar
|
2011-08-04 11:50:47 +02:00
|
|
|
------------ Testing setlocal/endlocal ------------
|
2011-11-29 11:46:16 +01:00
|
|
|
--- enable/disable extensions
|
2011-08-04 11:50:47 +02:00
|
|
|
@todo_wine@ErrLev:@space@
|
|
|
|
ErrLev: 0
|
|
|
|
ErrLev: 0
|
|
|
|
@todo_wine@ErrLev:@space@@or_broken@ErrLev: 0
|
|
|
|
ErrLev: 0
|
2011-11-29 11:46:16 +01:00
|
|
|
--- setlocal with corresponding endlocal
|
2011-08-04 11:50:47 +02:00
|
|
|
globalval
|
|
|
|
localval
|
|
|
|
globalval
|
|
|
|
globalval
|
2011-11-29 11:46:16 +01:00
|
|
|
--- setlocal with no corresponding endlocal
|
2011-08-04 11:50:47 +02:00
|
|
|
globalval
|
|
|
|
localval
|
|
|
|
@todo_wine@globalval
|
2011-11-29 11:45:51 +01: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
|
2011-10-26 16:57:52 +02:00
|
|
|
errorlevel with leading zero just right, good
|
|
|
|
errorlevel with negative number OK
|
2011-05-26 06:42:37 +02:00
|
|
|
abc0def@or_broken@abc1def
|
|
|
|
errorlevel zero, good@or_broken@errorlevel nonzero, bad
|
|
|
|
7 should be 7
|
|
|
|
7 should still be 7
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing GOTO ------------
|
2010-03-24 04:45:49 +01:00
|
|
|
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
|
2012-09-04 01:30:17 +02:00
|
|
|
------------ Testing PATH ------------
|
|
|
|
PATH=original
|
|
|
|
PATH=try2
|
|
|
|
PATH=try3
|
2011-11-29 11:45:51 +01:00
|
|
|
------------ Testing combined CALLs/GOTOs ------------
|
2011-09-11 17:14:56 +02:00
|
|
|
world
|
|
|
|
cheball
|
|
|
|
barbare
|
|
|
|
bar
|
|
|
|
foo
|
|
|
|
baz
|
|
|
|
cheball
|
|
|
|
barbare
|