diff options
Diffstat (limited to 'tests/mv.test')
-rwxr-xr-x | tests/mv.test | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/tests/mv.test b/tests/mv.test index ae39fb68..ab2ca5ed 100755 --- a/tests/mv.test +++ b/tests/mv.test @@ -8,98 +8,98 @@ #testing "name" "command" "result" "infile" "stdin" touch file -testing "mv old_file to new_file" "mv file file1 && [ ! -e file -a -f file1 ] && +testing "old_file to new_file" "mv file file1 && [ ! -e file -a -f file1 ] && echo 'yes'" "yes\n" "" "" rm -f file* touch file mkdir dir -testing "mv file to a dir" "mv file dir && [ ! -e file -a -f dir/file ] && +testing "file to a dir" "mv file dir && [ ! -e file -a -f dir/file ] && echo 'yes'" "yes\n" "" "" rm -rf file* dir* mkdir dir -testing "mv old_dir to new_dir" "mv dir dir1 && [ ! -e dir -a -d dir1 ] && +testing "old_dir to new_dir" "mv dir dir1 && [ ! -e dir -a -d dir1 ] && echo 'yes'" "yes\n" "" "" rm -rf dir* mkdir dir1 dir2 touch file1 file2 dir1/file3 ln -s file1 link1 -testing "mv multiple files/dir to a dir" "mv file1 file2 link1 dir1 dir2 && +testing "multiple files/dir to a dir" "mv file1 file2 link1 dir1 dir2 && [ ! -e file1 -a ! -e file2 -a ! -e link1 -a ! -e dir1 ] && [ -f dir2/file1 -a -f dir2/file2 -a -L dir2/link1 -a -d dir2/dir1 ] && [ -f dir2/dir1/file3 ] && readlink dir2/link1" "file1\n" "" "" rm -rf file* link* dir* touch file1 -testing "mv a empty file to new_file" "mv file1 file2 && +testing "a empty file to new_file" "mv file1 file2 && [ ! -e file1 -a -f file2 ] && stat -c %s file2" "0\n" "" "" rm -rf file* mkdir dir1 -testing "mv enpty dir to new_dir" "mv dir1 dir2 && +testing "enpty dir to new_dir" "mv dir1 dir2 && [ ! -d dir1 -a -d dir2 ] && echo 'yes'" "yes\n" "" "" rm -rf dir* dd if=/dev/zero of=file1 seek=10k count=1 >/dev/null 2>&1 -testing "mv file new_file (random file)" "mv file1 file2 && +testing "file new_file (random file)" "mv file1 file2 && [ ! -e file1 -a -f file2 ] && stat -c %s file2" "5243392\n" "" "" rm -f file* touch file1 ln -s file1 link1 -testing "mv link new_link (softlink)" "mv link1 link2 && +testing "link new_link (softlink)" "mv link1 link2 && [ ! -e link1 -a -L link2 ] && readlink link2" "file1\n" "" "" unlink tLink2 &>/dev/null rm -f file* link* touch file1 ln file1 link1 -testing "mv link new_link (hardlink)" "mv link1 link2 && +testing "link new_link (hardlink)" "mv link1 link2 && [ ! -e link1 -a -f link2 -a file1 -ef link2 ] && echo 'yes'" "yes\n" "" "" unlink link2 &>/dev/null rm -f file* link* touch file1 chmod a-r file1 -testing "mv file new_file (unreadable)" "mv file1 file2 && +testing "file new_file (unreadable)" "mv file1 file2 && [ ! -e file1 -a -f file2 ] && echo 'yes'" "yes\n" "" "" rm -f file* touch file1 ln file1 link1 mkdir dir1 -testing "mv file link dir (hardlink)" "mv file1 link1 dir1 && +testing "file link dir (hardlink)" "mv file1 link1 dir1 && [ ! -e file1 -a ! -e link1 -a -f dir1/file1 -a -f dir1/link1 ] && [ dir1/file1 -ef dir1/link1 ] && echo 'yes'" "yes\n" "" "" rm -rf file* link* dir* mkdir -p dir1/dir2 dir3 touch dir1/dir2/file1 dir1/dir2/file2 -testing "mv dir1/dir2 dir3/new_dir" "mv dir1/dir2 dir3/dir4 && +testing "dir1/dir2 dir3/new_dir" "mv dir1/dir2 dir3/dir4 && [ ! -e dir1/dir2 -a -d dir3/dir4 -a -f dir3/dir4/file1 ] && [ -f dir3/dir4/file2 ] && echo 'yes'" "yes\n" "" "" rm -rf file* dir* mkdir dir1 dir2 -testing "mv dir new_dir (already exist)" "mv dir1 dir2 && +testing "dir new_dir (already exist)" "mv dir1 dir2 && [ ! -e dir1 -a -d dir2/dir1 ] && echo 'yes'" "yes\n" "" "" rm -rf dir* touch file1 file2 -testing "mv -f file new_file (exist)" "mv -f file1 file2 && +testing "-f file new_file (exist)" "mv -f file1 file2 && [ ! -e file1 -a -e file2 ] && echo 'yes'" "yes\n" "" "" rm -f file* touch file1 file2 -testing "mv -n file new_file (exist)" "mv -n file1 file2 && +testing "-n file new_file (exist)" "mv -n file1 file2 && [ -e file1 -a -e file2 ] && echo 'yes'" "yes\n" "" "" rm -f file* touch file1 file2 chmod 400 file1 file2 -testing "mv file over unwritable file with no stdin" \ +testing "file over unwritable file with no stdin" \ "</dev/null mv file2 file1 && [ -e file -a ! -e file2 ] && echo 'yes'" \ "yes\n" "" "" rm -f file* |