aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.travis/test.sh
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-01-24 10:21:53 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-01-24 10:23:36 +0300
commit6f0add8092a043e4b10716b660057153d17f0d32 (patch)
tree313f86fbd8bc80d45d6c4f08d2164c0c4435f6c2 /.travis/test.sh
parentfix Travis test test_symlinks_unlink_works (diff)
downloadconfig-links-6f0add8092a043e4b10716b660057153d17f0d32.tar.gz
config-links-6f0add8092a043e4b10716b660057153d17f0d32.zip
Travis: test_symlinks_remove_shared_file
Diffstat (limited to '.travis/test.sh')
-rwxr-xr-x.travis/test.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/.travis/test.sh b/.travis/test.sh
index 5d8eabe..8443fe3 100755
--- a/.travis/test.sh
+++ b/.travis/test.sh
@@ -181,12 +181,47 @@ test_symlinks_unlink_works() {
verify_output "$expected_output" "$test_alt_dest_dir"
}
+test_symlinks_remove_shared_file() {
+ # If we remove a shared file, both of the symlinks 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"
+ 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"
+
+ 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/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->
+$test_alt_dest_dir/1.txt->$test_src_dir/%DEST%/1.txt
+$test_alt_dest_dir/foo->
+$test_alt_dest_dir/foo/2.txt->$test_src_dir/%DEST%/foo/2.txt
+$test_alt_dest_dir/bar->
+$test_alt_dest_dir/bar/baz->
+$test_alt_dest_dir/bar/baz/4.txt->$test_src_dir/%DEST%/bar/baz/4.txt"
+
+ verify_output "$expected_output" "$test_alt_dest_dir"
+}
+
main() {
test_update_works
test_unlink_works
test_unlink_does_not_overwrite_files
test_symlinks_update_works
test_symlinks_unlink_works
+ test_symlinks_remove_shared_file
}
main