summaryrefslogtreecommitdiffstats
path: root/imag-link
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-04-16 22:55:39 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-04-18 18:33:45 +0200
commit15fde996588b536d22b3b0b19973a15fe743259c (patch)
treeb4223046666403f301eb955734bc15b5c5b61b22 /imag-link
parente117fdaa70f70b7d31de20b7de4b8bbf987a122f (diff)
Add test whether linking actually links
Diffstat (limited to 'imag-link')
-rw-r--r--imag-link/tests/link-test.sh35
1 files changed, 33 insertions, 2 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 <<EOS
+---
+[imag]
+links = [$1]
+version = "0.1.0"
+---
+
+EOS
+}
+
mktestentry() {
mkdir -p ${STORE}
default_entry > ${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
}
+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_link_modificates \
+ test_linking_links