aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.travis/test.sh
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-01-24 10:42:25 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-01-24 10:44:19 +0300
commit9bb4912c1a4ac2120acf2c3f7bfc4f17ba2b3c3b (patch)
tree043f5c203913b5af0aa4f72b35696bd1c20cd5cb /.travis/test.sh
parentTravis: test_symlinks_remove_shared_file (diff)
downloadconfig-links-9bb4912c1a4ac2120acf2c3f7bfc4f17ba2b3c3b.tar.gz
config-links-9bb4912c1a4ac2120acf2c3f7bfc4f17ba2b3c3b.zip
Travis: test_symlinks_remove_symlink_dir
Diffstat (limited to '')
-rwxr-xr-x.travis/test.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/.travis/test.sh b/.travis/test.sh
index 8443fe3..81586e4 100755
--- a/.travis/test.sh
+++ b/.travis/test.sh
@@ -189,6 +189,7 @@ test_symlinks_remove_shared_file() {
ln -s -- '%DEST%' "$test_src_dir/%ALT_DEST%"
DEST="$test_dest_dir" ALT_DEST="$test_alt_dest_dir" "$script_dir/../bin/update.sh" --shared-dir "$test_src_dir"
+ # Remove a random shared file:
rm -- "$test_src_dir/%DEST%/bar/3.txt"
DEST="$test_dest_dir" ALT_DEST="$test_alt_dest_dir" "$script_dir/../bin/update.sh" --shared-dir "$test_src_dir"
@@ -215,6 +216,35 @@ $test_alt_dest_dir/bar/baz/4.txt->$test_src_dir/%DEST%/bar/baz/4.txt"
verify_output "$expected_output" "$test_alt_dest_dir"
}
+test_symlinks_remove_dir_symlink() {
+ # If we remove a directory symlink in --shared-dir, all the symlinks
+ # accessible through this directory symlink should be removed.
+
+ new_test
+
+ ln -s -- '%DEST%' "$test_src_dir/%ALT_DEST%"
+
+ DEST="$test_dest_dir" ALT_DEST="$test_alt_dest_dir" "$script_dir/../bin/update.sh" --shared-dir "$test_src_dir"
+ # Remove the directory symlink:
+ rm -- "$test_src_dir/%ALT_DEST%"
+ DEST="$test_dest_dir" ALT_DEST="$test_alt_dest_dir" "$script_dir/../bin/update.sh" --shared-dir "$test_src_dir"
+
+ local expected_output
+
+ expected_output="$test_dest_dir->
+$test_dest_dir/1.txt->$test_src_dir/%DEST%/1.txt
+$test_dest_dir/foo->
+$test_dest_dir/foo/2.txt->$test_src_dir/%DEST%/foo/2.txt
+$test_dest_dir/bar->
+$test_dest_dir/bar->3.txt->$test_src_dir/%DEST%/bar/3.txt
+$test_dest_dir/bar/baz->
+$test_dest_dir/bar/baz/4.txt->$test_src_dir/%DEST%/bar/baz/4.txt"
+ verify_output "$expected_output"
+
+ expected_output="$test_alt_dest_dir->"
+ verify_output "$expected_output" "$test_alt_dest_dir"
+}
+
main() {
test_update_works
test_unlink_works
@@ -222,6 +252,7 @@ main() {
test_symlinks_update_works
test_symlinks_unlink_works
test_symlinks_remove_shared_file
+ test_symlinks_remove_dir_symlink
}
main