diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-04-01 16:36:43 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-04-01 16:36:43 +0300 |
commit | 646815c3b8b0fd1cb96064ffab9d776ad681474f (patch) | |
tree | 8f58f9661af9caa5abbc3a5b8735751d0ff7df0c /test | |
parent | test: refactoring (diff) | |
download | config-links-646815c3b8b0fd1cb96064ffab9d776ad681474f.tar.gz config-links-646815c3b8b0fd1cb96064ffab9d776ad681474f.zip |
test: add a test case
Diffstat (limited to 'test')
-rwxr-xr-x | test/test.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test.sh b/test/test.sh index 9bb8e9d..f2920b5 100755 --- a/test/test.sh +++ b/test/test.sh @@ -176,6 +176,26 @@ $test_dest_dir/bar/3.txt->" verify_output "$expected_output" } +test_unlink_does_not_delete_used_dirs() { + # Check that if a user adds a file to a destination directory, it's not + # deleted when unlinking. + + new_test + call_update + + # User adds his own file to the directory: + echo 'User content' > "$test_dest_dir/bar/my-file" + + call_unlink + + # bar/ and bar/my-file must be kept: + local expected_output="$test_dest_dir-> +$test_dest_dir/bar-> +$test_dest_dir/bar/my-file->" + + verify_output "$expected_output" +} + new_test_dir_symlink() { new_test "${FUNCNAME[1]}" @@ -392,6 +412,7 @@ main() { test_update_works test_unlink_works test_unlink_does_not_overwrite_files + test_unlink_does_not_delete_used_dirs test_dir_symlink_update_works test_dir_symlink_unlink_works |