summaryrefslogtreecommitdiff
path: root/test/tests/link-relink-relative-leaves-file.bash
blob: 0eec478baa9e5b18700d6114d3ba9127fd23b830 (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='relink relative does not incorrectly relink file'
. '../test-lib.bash'

test_expect_success 'setup' '
echo "apple" > ${DOTFILES}/f &&
echo "grape" > ~/.f
'

test_expect_success 'run' '
run_dotbot <<EOF
- link:
    ~/.folder/f:
      path: f
      create: true
      relative: true
EOF
'

# these are done in a single block because they run in a subshell, and it
# wouldn't be possible to access `$mtime` outside of the subshell
test_expect_success 'test' '
mtime=$(stat ~/.folder/f | grep Modify)
run_dotbot <<EOF
- link:
    ~/.folder/f:
      path: f
      create: true
      relative: true
      relink: true
EOF
[[ "$mtime" == "$(stat ~/.folder/f | grep Modify)" ]]
'