diff options
author | Christopher Haster <chaster@utexas.edu> | 2017-04-15 20:35:20 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2017-04-18 09:44:01 +0300 |
commit | bd817abb00080898357385b5d358418d3072789d (patch) | |
tree | 7e6d98d601d6d4834bb150bb85d4fa7aeadc8a09 /tests/test_dirs.sh | |
parent | 3b1bcbe8517db576030450e0a88ff1b274570f58 (diff) |
Added support for renaming dirs/files
Diffstat (limited to 'tests/test_dirs.sh')
-rwxr-xr-x | tests/test_dirs.sh | 104 |
1 files changed, 103 insertions, 1 deletions
diff --git a/tests/test_dirs.sh b/tests/test_dirs.sh index 4026c3f..6d73e7a 100755 --- a/tests/test_dirs.sh +++ b/tests/test_dirs.sh @@ -123,7 +123,7 @@ tests/test.py << TEST lfs_unmount(&lfs) => 0; TEST -echo "--- Directory deletion ---" +echo "--- Directory remove ---" tests/test.py << TEST lfs_mount(&lfs, &config) => 0; lfs_remove(&lfs, "potato") => LFS_ERROR_INVALID; @@ -180,5 +180,107 @@ tests/test.py << TEST lfs_unmount(&lfs) => 0; TEST +echo "--- Directory rename ---" +tests/test.py << TEST + lfs_mount(&lfs, &config) => 0; + lfs_mkdir(&lfs, "coldpotato") => 0; + lfs_mkdir(&lfs, "coldpotato/baked") => 0; + lfs_mkdir(&lfs, "coldpotato/sweet") => 0; + lfs_mkdir(&lfs, "coldpotato/fried") => 0; + lfs_unmount(&lfs) => 0; +TEST +tests/test.py << TEST + lfs_mount(&lfs, &config) => 0; + lfs_rename(&lfs, "coldpotato", "hotpotato") => 0; + lfs_unmount(&lfs) => 0; +TEST +tests/test.py << TEST + lfs_mount(&lfs, &config) => 0; + lfs_dir_open(&lfs, &dir[0], "hotpotato") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, ".") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "..") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "baked") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "sweet") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "fried") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 0; + lfs_dir_close(&lfs, &dir[0]) => 0; + lfs_unmount(&lfs) => 0; +TEST +tests/test.py << TEST + lfs_mount(&lfs, &config) => 0; + lfs_mkdir(&lfs, "warmpotato") => 0; + lfs_mkdir(&lfs, "warmpotato/mushy") => 0; + lfs_rename(&lfs, "hotpotato", "warmpotato") => LFS_ERROR_INVALID; + + lfs_remove(&lfs, "warmpotato/mushy") => 0; + lfs_rename(&lfs, "hotpotato", "warmpotato") => 0; + + lfs_unmount(&lfs) => 0; +TEST +tests/test.py << TEST + lfs_mount(&lfs, &config) => 0; + lfs_dir_open(&lfs, &dir[0], "warmpotato") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, ".") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "..") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "baked") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "sweet") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "fried") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 0; + lfs_dir_close(&lfs, &dir[0]) => 0; + lfs_unmount(&lfs) => 0; +TEST +tests/test.py << TEST + lfs_mount(&lfs, &config) => 0; + lfs_mkdir(&lfs, "coldpotato") => 0; + lfs_rename(&lfs, "warmpotato/baked", "coldpotato/baked") => 0; + lfs_rename(&lfs, "warmpotato/sweet", "coldpotato/sweet") => 0; + lfs_rename(&lfs, "warmpotato/fried", "coldpotato/fried") => 0; + lfs_remove(&lfs, "coldpotato") => LFS_ERROR_INVALID; + lfs_remove(&lfs, "warmpotato") => 0; + lfs_unmount(&lfs) => 0; +TEST +tests/test.py << TEST + lfs_mount(&lfs, &config) => 0; + lfs_dir_open(&lfs, &dir[0], "coldpotato") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, ".") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "..") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "baked") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "sweet") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "fried") => 0; + info.type => LFS_TYPE_DIR; + lfs_dir_read(&lfs, &dir[0], &info) => 0; + lfs_dir_close(&lfs, &dir[0]) => 0; + lfs_unmount(&lfs) => 0; +TEST + echo "--- Results ---" tests/stats.py |