summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/tests/link-canonicalize.bash20
-rw-r--r--test/tests/link-no-canonicalize.bash23
2 files changed, 43 insertions, 0 deletions
diff --git a/test/tests/link-canonicalize.bash b/test/tests/link-canonicalize.bash
new file mode 100644
index 0000000..34015c8
--- /dev/null
+++ b/test/tests/link-canonicalize.bash
@@ -0,0 +1,20 @@
+test_description='linking canonicalizes path by default'
+. '../test-lib.bash'
+
+test_expect_success 'setup' '
+echo "apple" > ${DOTFILES}/f &&
+ln -s dotfiles dotfiles-symlink
+'
+
+test_expect_success 'run' '
+cat > "${DOTFILES}/${INSTALL_CONF}" <<EOF
+- link:
+ ~/.f:
+ path: f
+EOF
+${DOTBOT_EXEC} -c dotfiles-symlink/${INSTALL_CONF}
+'
+
+test_expect_success 'test' '
+[ "$(readlink ~/.f | cut -d/ -f4-)" = "dotfiles/f" ]
+'
diff --git a/test/tests/link-no-canonicalize.bash b/test/tests/link-no-canonicalize.bash
new file mode 100644
index 0000000..f9ccb99
--- /dev/null
+++ b/test/tests/link-no-canonicalize.bash
@@ -0,0 +1,23 @@
+test_description='linking path canonicalization can be disabled'
+. '../test-lib.bash'
+
+test_expect_success 'setup' '
+echo "apple" > ${DOTFILES}/f &&
+ln -s dotfiles dotfiles-symlink
+'
+
+test_expect_success 'run' '
+cat > "${DOTFILES}/${INSTALL_CONF}" <<EOF
+- defaults:
+ link:
+ canonicalize-path: false
+- link:
+ ~/.f:
+ path: f
+EOF
+${DOTBOT_EXEC} -c ./dotfiles-symlink/${INSTALL_CONF}
+'
+
+test_expect_success 'test' '
+[ "$(readlink ~/.f | cut -d/ -f4-)" = "dotfiles-symlink/f" ]
+'