1
0
Fork 0
mirror of synced 2024-11-17 22:15:35 -05:00
dotbot/test/tests/link-if.bash

52 lines
725 B
Bash
Raw Normal View History

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