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