mirror of
1
0
Fork 0

Add test for conditional linking

This commit is contained in:
Anish Athalye 2018-10-16 20:22:50 -04:00
parent a9cf9fffe4
commit b0ce63904c
1 changed files with 30 additions and 0 deletions

View File

@ -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
'