diff options
author | Anish Athalye <me@anishathalye.com> | 2016-02-14 22:39:48 -0500 |
---|---|---|
committer | Anish Athalye <me@anishathalye.com> | 2016-02-14 23:06:52 -0500 |
commit | daf8d82e02c2bcc476932790fa25076631c4c312 (patch) | |
tree | 1413dbbb3e810618e127a17ac3843ee9a8be653c /test | |
parent | c402396c58114640745dbba132856cfd8cd7f422 (diff) |
Add functionality to create relative links
This commit adds an option to the extended configuration syntax for
linking files and directories. Enabling the relative option makes it so
that symbolic links are created with relative paths instead of absolute
paths.
Diffstat (limited to 'test')
-rw-r--r-- | test/tests/link-relative.bash | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/tests/link-relative.bash b/test/tests/link-relative.bash new file mode 100644 index 0000000..ac55c17 --- /dev/null +++ b/test/tests/link-relative.bash @@ -0,0 +1,36 @@ +test_description='relative linking works' +. '../test-lib.bash' + +test_expect_success 'setup' ' +echo "apple" > ${DOTFILES}/f && +mkdir ${DOTFILES}/d && +echo "grape" > ${DOTFILES}/d/e +' + +test_expect_success 'run' ' +run_dotbot <<EOF +- link: + ~/.f: + path: f + ~/.frel: + path: f + relative: true + ~/nested/.frel: + path: f + create: true + relative: true + ~/.d: + path: d + relative: true +EOF +' + +test_expect_success 'test' ' +grep "apple" ~/.f && +grep "apple" ~/.frel && +[[ "$(readlink ~/.f)" == "$(readlink -f dotfiles/f)" ]] && +[[ "$(readlink ~/.frel)" == "dotfiles/f" ]] && +[[ "$(readlink ~/nested/.frel)" == "../dotfiles/f" ]] && +grep "grape" ~/.d/e && +[[ "$(readlink ~/.d)" == "dotfiles/d" ]] +' |