diff options
Diffstat (limited to 'test')
3 files changed, 61 insertions, 0 deletions
diff --git a/test/tests/link-environment-variable-expansion-source.bash b/test/tests/link-environment-variable-expansion-source.bash new file mode 100644 index 0000000..50456d6 --- /dev/null +++ b/test/tests/link-environment-variable-expansion-source.bash @@ -0,0 +1,18 @@ +test_description='link expands environment variables in source' +. '../test-lib.bash' + +test_expect_success 'setup' ' +echo "grape" > ${DOTFILES}/h +' + +test_expect_success 'run' ' +export APPLE="h" && +run_dotbot <<EOF +- link: + ~/.i: \$APPLE +EOF +' + +test_expect_success 'test' ' +grep "grape" ~/.i +' diff --git a/test/tests/link-environment-variable-expansion-target.bash b/test/tests/link-environment-variable-expansion-target.bash new file mode 100644 index 0000000..3a2e4dd --- /dev/null +++ b/test/tests/link-environment-variable-expansion-target.bash @@ -0,0 +1,25 @@ +test_description='link expands environment variables in target' +. '../test-lib.bash' + +test_expect_success 'setup' ' +echo "apple" > ${DOTFILES}/f && +echo "grape" > ${DOTFILES}/h +' + +test_expect_success 'run' ' +export ORANGE=".config" && +export BANANA="g" && +unset PEAR && +run_dotbot <<EOF +- link: + ~/\${ORANGE}/\$BANANA: + path: f + create: true + ~/\$PEAR: h +EOF +' + +test_expect_success 'test' ' +grep "apple" ~/.config/g && +grep "grape" ~/\$PEAR +' diff --git a/test/tests/link-environment-variable-unset.bash b/test/tests/link-environment-variable-unset.bash new file mode 100644 index 0000000..8673729 --- /dev/null +++ b/test/tests/link-environment-variable-unset.bash @@ -0,0 +1,18 @@ +test_description='link leaves unset environment variables' +. '../test-lib.bash' + +test_expect_success 'setup' ' +echo "apple" > ${DOTFILES}/\$ORANGE +' + +test_expect_success 'run' ' +unset ORANGE && +run_dotbot <<EOF +- link: + ~/.f: \$ORANGE +EOF +' + +test_expect_success 'test' ' +grep "apple" ~/.f +' |