From 212949f1086c2f492b98fad7770d33ab7f3a4661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delanoy?= Date: Tue, 11 Oct 2011 19:04:31 +0200 Subject: [PATCH] cmd/tests: Add MOVE tests. --- programs/cmd/tests/test_builtins.cmd | 70 ++++++++++++++++++++++++ programs/cmd/tests/test_builtins.cmd.exp | 15 +++++ 2 files changed, 85 insertions(+) diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index 35ab181b95..49e3fded46 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -909,6 +909,76 @@ if not exist baz\abc ( ) 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 ------------ call :setError 0 echo ... md and mkdir are synonymous ... diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 31b17808b3..33a8113dbf 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -604,6 +604,21 @@ bar ... rename in other directory ... @todo_wine@rename impossible in other directory @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 ------------ ... md and mkdir are synonymous ... 0