summaryrefslogtreecommitdiff
path: root/test/tests/link-if.bash
blob: 9fe64292a3379c33f5495b21615bf3557d5accbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
'