cmd/tests: Add MOVE tests.
This commit is contained in:
parent
652d80d9d8
commit
212949f108
|
@ -909,6 +909,76 @@ if not exist baz\abc (
|
||||||
)
|
)
|
||||||
cd .. & rd /s/q foobar
|
cd .. & rd /s/q foobar
|
||||||
|
|
||||||
|
echo ------------ Testing move ------------
|
||||||
|
mkdir foobar & cd foobar
|
||||||
|
echo ... file move ...
|
||||||
|
echo >foo
|
||||||
|
move foo bar > nul 2>&1
|
||||||
|
if not exist foo (
|
||||||
|
if exist bar (
|
||||||
|
echo file move succeeded
|
||||||
|
)
|
||||||
|
)
|
||||||
|
echo bar>bar
|
||||||
|
echo baz> baz
|
||||||
|
move /Y bar baz > nul 2>&1
|
||||||
|
if not exist bar (
|
||||||
|
if exist baz (
|
||||||
|
echo file move with overwrite succeeded
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
echo file overwrite impossible!
|
||||||
|
del bar
|
||||||
|
)
|
||||||
|
type baz
|
||||||
|
|
||||||
|
mkdir rep
|
||||||
|
move baz rep > nul 2>&1
|
||||||
|
if not exist baz (
|
||||||
|
if exist rep\baz (
|
||||||
|
echo file moved in subdirectory
|
||||||
|
)
|
||||||
|
)
|
||||||
|
call :setError 0
|
||||||
|
move rep\baz . > nul 2>&1
|
||||||
|
move /Y baz baz > nul 2>&1
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo moving a file to itself should be a no-op!
|
||||||
|
) else (
|
||||||
|
echo moving a file to itself is a no-op
|
||||||
|
)
|
||||||
|
echo ErrorLevel: %ErrorLevel%
|
||||||
|
call :setError 0
|
||||||
|
del baz
|
||||||
|
echo ... directory move ...
|
||||||
|
mkdir foo\bar
|
||||||
|
mkdir baz
|
||||||
|
echo baz2>baz\baz2
|
||||||
|
move baz foo\bar > nul 2>&1
|
||||||
|
if not exist baz (
|
||||||
|
if exist foo\bar\baz\baz2 (
|
||||||
|
echo simple directory move succeeded
|
||||||
|
)
|
||||||
|
)
|
||||||
|
call :setError 0
|
||||||
|
mkdir baz
|
||||||
|
move baz baz > nul 2>&1
|
||||||
|
echo moving a directory to itself gives error; errlevel %ErrorLevel%
|
||||||
|
echo ...... dir in dir move ......
|
||||||
|
rd /s/q foo
|
||||||
|
mkdir foo bar
|
||||||
|
echo foo2>foo\foo2
|
||||||
|
echo bar2>bar\bar2
|
||||||
|
move foo bar > nul 2>&1
|
||||||
|
if not exist foo (
|
||||||
|
if exist bar (
|
||||||
|
dir /b /ad bar
|
||||||
|
dir /b /a-d bar
|
||||||
|
dir /b bar\foo
|
||||||
|
)
|
||||||
|
)
|
||||||
|
cd .. & rd /s/q foobar
|
||||||
|
|
||||||
echo ------------ Testing mkdir ------------
|
echo ------------ Testing mkdir ------------
|
||||||
call :setError 0
|
call :setError 0
|
||||||
echo ... md and mkdir are synonymous ...
|
echo ... md and mkdir are synonymous ...
|
||||||
|
|
|
@ -604,6 +604,21 @@ bar
|
||||||
... rename in other directory ...
|
... rename in other directory ...
|
||||||
@todo_wine@rename impossible in other directory
|
@todo_wine@rename impossible in other directory
|
||||||
@todo_wine@original file still present
|
@todo_wine@original file still present
|
||||||
|
------------ Testing move ------------
|
||||||
|
... file move ...
|
||||||
|
file move succeeded
|
||||||
|
@todo_wine@file move with overwrite succeeded@or_broken@file overwrite impossible!
|
||||||
|
@todo_wine@bar@or_broken@baz
|
||||||
|
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
|
||||||
|
... directory move ...
|
||||||
|
simple directory move succeeded
|
||||||
|
moving a directory to itself gives error; errlevel 1
|
||||||
|
...... dir in dir move ......
|
||||||
|
foo
|
||||||
|
bar2
|
||||||
|
foo2
|
||||||
------------ Testing mkdir ------------
|
------------ Testing mkdir ------------
|
||||||
... md and mkdir are synonymous ...
|
... md and mkdir are synonymous ...
|
||||||
0
|
0
|
||||||
|
|
Loading…
Reference in New Issue