Newer
Older
@pwd@>echo Tests for cmd's builtin commands@space@
Tests for cmd's builtin commands
@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@
"/?"
@pwd@>echo .@space@
.
@pwd@>echo.word
word
@pwd@>echo .word@space@
.word
@pwd@>echo :@space@
:
@pwd@>echo:word
@pwd@>echo :word@space@
:word
Frédéric Delanoy
committed
@pwd@>echo off now@space@
off now
@pwd@>echo word@space@@space@
word@space@
@pwd@>echo word@space@@space@@space@
word@space@@space@
@todo_wine@@pwd@>echo word@space@
word
@pwd@>echo@tab@word@space@
@pwd@>echo@tab@word@space@@tab@@space@
@pwd@>echo@tab@word@tab@@space@@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@
------------ Testing 'echo' [OFF] --------------
word
'singlequotedword'
"doublequotedword"
at-echoed-word
"/?"
.
Frédéric Delanoy
committed
on again
word@space@
word@space@@space@
word
word@space@@tab@
word@tab@@space@
word
@tab@word
@space@@tab@word
------------ Testing rem --------------
@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@
@pwd@>rem @tab@ Hello@space@
@pwd@>rem@tab@ Hello@space@
@pwd@>rem@tab@echo foo & echo bar@space@
------------ Testing redirection operators --------------
...stdout redirection
foo
foo@space@
foo@tab@
foo@space@
foo@tab@
foo7@space@@or_broken@foo@tab@
foo9@space@@or_broken@foo@tab@
foo1
foo11
foo12
...stdout appending
foo
foo@space@
foob@space@
foob@space@
fooc@space@
foob@space@
fooc@space@
food1
foob@space@
fooc@space@
food1
food2
food21
@todo_wine@foo7@space@@space@@or_broken@not supported@space@
@todo_wine@foo@or_broken@not supported
@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
Dan Kegel
committed
------------ Testing 'set' --------------
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
Frédéric Delanoy
committed
FOOBAR = baz2
FOOBAR not defined
1
bar
foobar
FOO not defined
BAZ=bazbaz
bazbaz
Dan Kegel
committed
set "FOO=bar" should not include the quotes in the variable value
bar
foo
''
------------ Testing variable expansion --------------
~dp0 should be directory containing batch file
@pwd@\
@pwd@\
Frédéric Delanoy
committed
CD value @pwd@@or_broken@CD value@space@
%
P
P
S
P
PS
ERRORLEVEL
0
00
------------ Testing variable substrings --------------
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
------------ Testing variable substitution --------------
...in FOR variables
@todo_wine@"A B"
C
'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'
...in parameters
@todo_wine@"A B"
C
@todo_wine@'A B'@or_broken@''
'C'@or_broken@''
@todo_wine@@pwd@\C D
@pwd@\E
@drive@
@drive@
@path@
@path@
@todo_wine@L M
N
@todo_wine@'.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@''
@drive@@path@
@drive@@path@
@drive@
@drive@
@drive@
@drive@
''
'.eh'@or_broken@''
------------ 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!
...using /V cmd flag
foo
@todo_wine@foo@or_broken@!FOO!
foo
!FOO!
------------ Testing conditional execution --------------
@todo_wine@...unconditional &
foo1
bar2@space@
foo2
@todo_wine@...on success conditional &&
@todo_wine@foo3 not created
bar4@space@
foo4
@todo_wine@...on failure conditional ||
@todo_wine@foo5
@todo_wine@foo6@space@
------------ Testing cd ------------
singleFile
Current dir: @pwd@\foobar@or_broken@Current dir:@space@
@pwd@\foobar
@pwd@
@pwd@\foobar
@pwd@
@pwd@\foobar
@pwd@
@pwd@\foobar\bar bak
@pwd@\foobar\bar bak
@pwd@
------------ Testing type ------------
@pwd@>type foobaz@space@
bar
@pwd@>echo ***@space@
***
bar
***
------------ Testing NUL ------------
bar
bar
bar
NUL
@todo_wine@foo created
------------ Testing if/else --------------
if/else should work with blocks
if seems to work
else seems to work
@todo_wine@if seems not to detect /c as parameter
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
doom
doom
doom
lol
quake
quake
quake
%I
%I
%I
%j
%j
%j
1
4
1
A
B
C
`echo
A
B`
'echo
A
B'
@todo_wine@"echo A B"
@todo_wine@"A B"
C
...imbricated FORs
@todo_wine@X Y
@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
...basic wildcards
bazbaz
...for /L
1
3
5
1
3
5
0
2
1
-1
@todo_wine@ErrorLevel 0
@todo_wine@ErrorLevel 0
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
...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
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
...for /F
......string argument
a
a
a
a
a
......fileset argument
.........basic blank handling
a
a
a
a
a
b
.........multi-line with empty lines
a
b
c
.........multiple files
a
b
c
q
kkk
q
kkk
a
b
c
......eol option
@todo_wine@ad
@todo_wine@z@y
@todo_wine@a|d
@todo_wine@no output
@todo_wine@no output
......delims option
@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:\
......skip option
@todo_wine@c
@todo_wine@no output
@todo_wine@no output
-----------Testing del /a-----------
not-r.test not found after delete, good
r.test found before delete, good
r.test not found after delete, good
Dan Kegel
committed
------------ Testing del /q --------------
del /q * succeeded on file1
del /q * succeeded on file2.dat
------------ Testing del /s --------------
----------- Testing mkdir -----------
0
0
Dan Kegel
committed
1
1
Dan Kegel
committed
1
Frédéric Delanoy
committed
0
dir created
0
mkdir ? gives errorlevel 1
mkdir ?\foo gives errorlevel 1
mkdir foo\? gives errorlevel 1
Dan Kegel
committed
ok, foo created
mkdir foo\bar\? gives errorlevel 1
Dan Kegel
committed
ok, foo\bar created
bar created
foobar created
bar\baz created
Dan Kegel
committed
mkdir foo\* errorlevel 1
ok, foo created
----------- 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
recursive rmdir succeeded
recursive rmdir succeeded
foo removed
bar removed
foobar removed
bar\baz removed
------------ Testing attrib --------------
@todo_wine@A @pwd@\foobar\foo@or_broken@A @pwd@\foobar\foo@or_broken@A 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 original contents
Read-only file not deleted
Read-only file forcibly deleted
... 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 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 @pwd@\foobar\bar@or_broken@A @pwd@\foobar\bar@or_broken@A I @pwd@\foobar\bar
@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@A @pwd@\foobar\baz\toto@or_broken@A @pwd@\foobar\baz\toto@or_broken@A I @pwd@\foobar\baz\toto
toto
lulu
file created in read-only dir
Frédéric Delanoy
committed
foo@space@
foo@space@@space@
foo bar@space@
@todo_wine@foo ""@space@
@todo_wine@"" bar@space@
foo ''@space@
'' bar@space@
foo@space@
foo bar
@todo_wine@foo ""
@todo_wine@"" bar
foo ''
'' bar
@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
------------ 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
-----------Testing Errorlevel-----------
Frédéric Delanoy
committed
9009
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
-----------Testing GOTO-----------
goto with no leading space worked
goto with a leading space worked
goto with a leading tab worked
goto with a following space worked
-----------Done, jumping to EOF-----------