summaryrefslogtreecommitdiff
path: root/test/tests/link-if.bash
diff options
context:
space:
mode:
Diffstat (limited to 'test/tests/link-if.bash')
-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
+'