Sweden-Number/programs/cmd/tests/test_builtins.cmd.exp

346 lines
5.3 KiB
Plaintext

@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@
"/?"
@todo_wine@@pwd@>echo.
@pwd@>echo .@space@
.
@todo_wine@@pwd@>echo.word
word
@pwd@>echo .word@space@
.word
@todo_wine@@pwd@>echo:
@pwd@>echo :@space@
:
@todo_wine@@pwd@>echo:word
word
@pwd@>echo :word@space@
:word
@pwd@>echo word@space@@space@
word@space@
@pwd@>echo word@space@@space@@space@
word@space@@space@
------------ Testing 'echo' [OFF] --------------
word
'singlequotedword'
"doublequotedword"
at-echoed-word
"/?"
.
word
.word
:
word
:word
word@space@
word@space@@space@
------------ 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
@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
------------ 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
FOOBAR = baz2
FOOBAR not defined
1
bar
foobar
FOO not defined
BAZ=bazbaz
bazbaz
set "FOO=bar" should not include the quotes in the variable value
bar
------------ Testing variable expansion --------------
~dp0 should be directory containing batch file
@pwd@\
@pwd@\
CD value @pwd@@or_broken@CD value@space@
%
P
P
S
P
PS
ERRORLEVEL
0
00
0ERRORLEVEL
0
0%
P0
0S
P0S
------------ 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@foobar deleted
@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 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
-----------Testing for -----------
...plain FOR
A
B
C
%I
%I
%I
%j
%j
%j
A
B
C
1
4
1
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 /d
baz
foo
bar
...for /L
1
3
5
1
3
5
0
2
1
-1
@todo_wine@ErrorLevel 0
@todo_wine@ErrorLevel 0
-----------Testing del /a-----------
not-r.test not found after delete, good
r.test found before delete, good
r.test not found after delete, good
------------ Testing del /q --------------
del /q * succeeded on file1
del /q * succeeded on file2.dat
------------ Testing del /s --------------
----------- Testing mkdir -----------
0
0
@todo_wine@1
@todo_wine@1
0
0
0
0
0
@todo_wine@1
0
0
0
dir created
0
@todo_wine@1
@todo_wine@1
@todo_wine@1
@todo_wine@ok, foo created
@todo_wine@1
@todo_wine@ok, foo\bar created
foo created
@todo_wine@bar created
@todo_wine@foobar created
@todo_wine@bar\baz 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 CALL --------------
foo@space@
@todo_wine@foo 8
foo@space@@space@
foo bar@space@
@todo_wine@foo ""@space@
@todo_wine@"" bar@space@
foo ''@space@
'' bar@space@
bar :testRoutine
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 Errorlevel-----------
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-----------