summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnish Athalye <me@anishathalye.com>2018-10-16 20:22:50 -0400
committerAnish Athalye <me@anishathalye.com>2018-10-16 20:22:50 -0400
commitb0ce63904c98a0f3f6547dc0d770aad22b08a8ef (patch)
tree7e961b90a7c017c4a698c4c7ba8f266e510370cd /test
parenta9cf9fffe4b7ac6ed9f58d69e06f75681715a0e2 (diff)
Add test for conditional linking
Diffstat (limited to 'test')
-rw-r--r--test/tests/link-if.bash30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/tests/link-if.bash b/test/tests/link-if.bash
index de7948f..9fe6429 100644
--- a/test/tests/link-if.bash
+++ b/test/tests/link-if.bash
@@ -1,2 +1,32 @@
test_description='link if'
. '../test-lib.bash'
+
+test_expect_success 'setup' '
+mkdir ~/d
+echo "apple" > ${DOTFILES}/f
+'
+
+test_expect_success 'run' '
+run_dotbot <<EOF
+- link:
+ ~/.f:
+ path: f
+ if: "true"
+ ~/.g:
+ path: f
+ if: "false"
+ ~/.h:
+ path: f
+ if: "[[ -d ~/d ]]"
+ ~/.i:
+ path: f
+ if: "badcommand"
+EOF
+'
+
+test_expect_success 'test' '
+grep "apple" ~/.f &&
+! test -f ~/.g &&
+grep "apple" ~/.h &&
+! test -f ~/.i
+'