2018-02-23 16:56:19 -05:00
|
|
|
test_description='link if'
|
|
|
|
. '../test-lib.bash'
|
2018-10-16 20:22:50 -04:00
|
|
|
|
|
|
|
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
|
2020-12-18 14:34:28 -05:00
|
|
|
if: "[ -d ~/d ]"
|
2018-10-16 20:22:50 -04:00
|
|
|
~/.i:
|
|
|
|
path: f
|
|
|
|
if: "badcommand"
|
|
|
|
EOF
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'test' '
|
|
|
|
grep "apple" ~/.f &&
|
|
|
|
! test -f ~/.g &&
|
|
|
|
grep "apple" ~/.h &&
|
|
|
|
! test -f ~/.i
|
|
|
|
'
|
2018-11-19 20:38:29 -05:00
|
|
|
|
|
|
|
test_expect_success 'run 2' '
|
|
|
|
run_dotbot <<EOF
|
|
|
|
- defaults:
|
|
|
|
link:
|
|
|
|
if: "false"
|
|
|
|
- link:
|
|
|
|
~/.j:
|
|
|
|
path: f
|
|
|
|
if: "true"
|
|
|
|
~/.k:
|
|
|
|
path: f
|
|
|
|
EOF
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'test 2' '
|
|
|
|
grep "apple" ~/.j &&
|
|
|
|
! test -f ~/.k
|
|
|
|
'
|