From 15fde996588b536d22b3b0b19973a15fe743259c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 16 Apr 2016 22:55:39 +0200 Subject: [PATCH] Add test whether linking actually links --- imag-link/tests/link-test.sh | 37 +++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/imag-link/tests/link-test.sh b/imag-link/tests/link-test.sh index 362b0292..2caf8e99 100644 --- a/imag-link/tests/link-test.sh +++ b/imag-link/tests/link-test.sh @@ -14,6 +14,17 @@ version = "0.1.0" EOS } +entry_linked_to() { + cat < ${STORE}/$1 @@ -23,7 +34,7 @@ test_link_modificates() { mktestentry "test~0.1.0" mktestentry "test2~0.1.0" - imag-link --from "test~0.1.0" --to "test2~0.1.0" + imag-link internal add --from "test~0.1.0" --to "test2~0.1.0" if [[ "$(default_entry)" -eq "$(cat_entry 'test~0.1.0')" ]] || [[ "$(default_entry)" -eq "$(cat_entry 'test2~0.1.0')" ]] @@ -33,6 +44,26 @@ test_link_modificates() { fi } -invoke_tests \ - test_link_modificates +test_linking_links() { + mktestentry "test~0.1.0" + mktestentry "test2~0.1.0" + + imag-link internal add --from "test~0.1.0" --to "test2~0.1.0" + + if [[ "$(entry_linked_to '/test~0.1.0')" == "$(cat_entry 'test2~0.1.0')" ]]; + then + err "Linking to 'test~0.1.0' didn't succeed for 'test2~0.1.0'" + err $(cat_entry 'test2~0.1.0') + fi + + if [[ "$(entry_linked_to '/test2~0.1.0')" == "$(cat_entry 'test~0.1.0')" ]]; + then + err "Linking to 'test2~0.1.0' didn't succeed for 'test~0.1.0'" + err $(cat_entry 'test~0.1.0') + fi +} + +invoke_tests \ + test_link_modificates \ + test_linking_links