diff options
author | Anish Athalye <me@anishathalye.com> | 2018-04-13 08:49:09 -0400 |
---|---|---|
committer | Anish Athalye <me@anishathalye.com> | 2018-04-13 08:49:09 -0400 |
commit | 2f4cc0d9cb70235e7c5820dc4e7dd89b1d375fb5 (patch) | |
tree | b2545b0ca9eb6a7a141a898b0a9d15896210a90a /test | |
parent | a517c4c5d0b6bdd8ab3a62f3c6c3f38837354bde (diff) | |
parent | 972e80f18850d0cd45f22d2a4c14320f3cd204c6 (diff) |
Merge branch 'glob'
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..7e23348 --- /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}/foo +' + +test_expect_failure 'run 1' ' +run_dotbot <<EOF +- link: + ~/foo/: + path: foo + glob: true +EOF +' + +test_expect_failure 'test 1' ' +test -d ~/foo +' + +test_expect_failure 'run 2' ' +run_dotbot <<EOF +- link: + ~/foo/: + path: foo/ + glob: true +EOF +' + +test_expect_failure 'test 2' ' +test -d ~/foo +' + +test_expect_success 'run 3' ' +run_dotbot <<EOF +- link: + ~/foo: + path: foo + glob: true +EOF +' + +test_expect_success 'test 3' ' +test -d ~/foo +' 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 +' |