1
0
Fork 0
mirror of synced 2024-06-15 21:51:10 -04:00
dotbot/test/tests/copy-create.bash
Julian_Chu ea28276eec Implement simple copy plugin
reuse `link` plugin to write `copy`.
2020-05-09 00:25:19 +09:00

46 lines
896 B
Bash

test_description='Basic copy test'
. '../test-lib.bash'
test_expect_success 'setup' '
mkdir -p ${DOTFILES}/box
echo "apple" > ${DOTFILES}/apple
echo "banana" > ${DOTFILES}/box/banana
'
test_expect_failure 'copy file should fail without create option' '
run_dotbot <<EOF
- copy:
~/more/fruits/apple:
path: apple
EOF
'
test_expect_failure 'copy directory should fail without create option' '
run_dotbot <<EOF
- copy:
~/more/fruits/in:
path: box
EOF
'
test_expect_success 'run with create option' '
run_dotbot <<EOF
- copy:
~/more/fruits/apple:
path: apple
create: true
~/more/fruits/unbox/:
path: box
create: true
EOF
'
test_expect_success 'content test' '
grep "apple" ~/more/fruits/apple &&
grep "banana" ~/more/fruits/unbox/banana
'
test_expect_success 'tear down' '
rm -rf ~/more
rm ${DOTFILES}/apple
rm -rf ${DOTFILES}/box
'