diff options
author | Anish Athalye <me@anishathalye.com> | 2018-04-06 22:09:57 +0530 |
---|---|---|
committer | Anish Athalye <me@anishathalye.com> | 2018-04-13 08:49:02 -0400 |
commit | 8d08e4b1adfd00092835b6aed0edecd222f49977 (patch) | |
tree | 452084fadf137ceff345221afafd1f8f6b01816d /test | |
parent | 7d069b4ac8723be24010ac79c1185a231fa458f2 (diff) |
Add tests for globbing
Diffstat (limited to 'test')
-rw-r--r-- | test/tests/link-glob-ambiguous.bash | 45 | ||||
-rw-r--r-- | test/tests/link-glob-multi-star.bash | 31 | ||||
-rw-r--r-- | test/tests/link-glob.bash | 47 |
3 files changed, 123 insertions, 0 deletions
diff --git a/test/tests/link-glob-ambiguous.bash b/test/tests/link-glob-ambiguous.bash new file mode 100644 index 0000000..97d42cd --- /dev/null +++ b/test/tests/link-glob-ambiguous.bash @@ -0,0 +1,45 @@ +test_description='link glob ambiguous' +. '../test-lib.bash' + +test_expect_success 'setup' ' +mkdir ${DOTFILES}/bin +' + +test_expect_failure 'run 1' ' +run_dotbot <<EOF +- link: + ~/bin/: + path: bin + glob: true +EOF +' + +test_expect_failure 'test 1' ' +test -d ~/bin +' + +test_expect_failure 'run 2' ' +run_dotbot <<EOF +- link: + ~/bin/: + path: bin/ + glob: true +EOF +' + +test_expect_failure 'test 2' ' +test -d ~/bin +' + +test_expect_success 'run 3' ' +run_dotbot <<EOF +- link: + ~/bin: + path: bin + glob: true +EOF +' + +test_expect_success 'test 3' ' +test -d ~/bin +' diff --git a/test/tests/link-glob-multi-star.bash b/test/tests/link-glob-multi-star.bash new file mode 100644 index 0000000..11ae740 --- /dev/null +++ b/test/tests/link-glob-multi-star.bash @@ -0,0 +1,31 @@ +test_description='link glob' +. '../test-lib.bash' + +test_expect_success 'setup' ' +mkdir ${DOTFILES}/config && +mkdir ${DOTFILES}/config/foo && +mkdir ${DOTFILES}/config/bar && +echo "apple" > ${DOTFILES}/config/foo/a && +echo "banana" > ${DOTFILES}/config/bar/b && +echo "cherry" > ${DOTFILES}/config/bar/c +' + +test_expect_success 'run' ' +run_dotbot -v <<EOF +- defaults: + link: + glob: true + create: true +- link: + ~/.config/: config/*/* +EOF +' + +test_expect_success 'test' ' +! readlink ~/.config/ && +! readlink ~/.config/foo && +readlink ~/.config/foo/a && +grep "apple" ~/.config/foo/a && +grep "banana" ~/.config/bar/b && +grep "cherry" ~/.config/bar/c +' diff --git a/test/tests/link-glob.bash b/test/tests/link-glob.bash new file mode 100644 index 0000000..f1c813d --- /dev/null +++ b/test/tests/link-glob.bash @@ -0,0 +1,47 @@ +test_description='link glob' +. '../test-lib.bash' + +test_expect_success 'setup 1' ' +mkdir ${DOTFILES}/bin && +echo "apple" > ${DOTFILES}/bin/a && +echo "banana" > ${DOTFILES}/bin/b && +echo "cherry" > ${DOTFILES}/bin/c +' + +test_expect_success 'run 1' ' +run_dotbot -v <<EOF +- defaults: + link: + glob: true + create: true +- link: + ~/bin: bin/* +EOF +' + +test_expect_success 'test 1' ' +grep "apple" ~/bin/a && +grep "banana" ~/bin/b && +grep "cherry" ~/bin/c +' + +test_expect_success 'setup 2' ' +rm -rf ~/bin +' + +test_expect_success 'run 2' ' +run_dotbot -v <<EOF +- defaults: + link: + glob: true + create: true +- link: + ~/bin/: bin/* +EOF +' + +test_expect_success 'test 2' ' +grep "apple" ~/bin/a && +grep "banana" ~/bin/b && +grep "cherry" ~/bin/c +' |