diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c95a26..eaf8048 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,6 +144,7 @@ if (BUILD_TESTS) add_sdcv_shell_test(t_list) add_sdcv_shell_test(t_use) + add_sdcv_shell_test(t_synonyms) add_sdcv_shell_test(t_interactive) add_sdcv_shell_test(t_utf8output) add_sdcv_shell_test(t_utf8input) diff --git a/tests/stardict-test_synonyms-2.4.2/test.dict.dz b/tests/stardict-test_synonyms-2.4.2/test.dict.dz new file mode 100644 index 0000000..c081b89 Binary files /dev/null and b/tests/stardict-test_synonyms-2.4.2/test.dict.dz differ diff --git a/tests/stardict-test_synonyms-2.4.2/test.idx b/tests/stardict-test_synonyms-2.4.2/test.idx new file mode 100644 index 0000000..b412056 Binary files /dev/null and b/tests/stardict-test_synonyms-2.4.2/test.idx differ diff --git a/tests/stardict-test_synonyms-2.4.2/test.ifo b/tests/stardict-test_synonyms-2.4.2/test.ifo new file mode 100644 index 0000000..130d89f --- /dev/null +++ b/tests/stardict-test_synonyms-2.4.2/test.ifo @@ -0,0 +1,7 @@ +StarDict's dict ifo file +version=2.4.2 +bookname=Test synonyms +wordcount=1 +synwordcount=2 +idxfilesize=13 +sametypesequence=m diff --git a/tests/stardict-test_synonyms-2.4.2/test.syn b/tests/stardict-test_synonyms-2.4.2/test.syn new file mode 100644 index 0000000..e4c409d Binary files /dev/null and b/tests/stardict-test_synonyms-2.4.2/test.syn differ diff --git a/tests/stardict-test_synonyms-2.4.2/test.xml b/tests/stardict-test_synonyms-2.4.2/test.xml new file mode 100644 index 0000000..999c1e3 --- /dev/null +++ b/tests/stardict-test_synonyms-2.4.2/test.xml @@ -0,0 +1,18 @@ + + + + 2.4.2 + Test synonyms + + + + + + + +
testfoobar + + + +
+
diff --git a/tests/t_synonyms b/tests/t_synonyms new file mode 100755 index 0000000..3ad3951 --- /dev/null +++ b/tests/t_synonyms @@ -0,0 +1,22 @@ +#!/bin/sh + +set -e + +SDCV="$1" +TEST_DIR="$2" + +unset SDCV_PAGER +test_word() { + WORD=$1 + RES=$($SDCV -n --data-dir "$TEST_DIR" -u "Test synonyms" $WORD | grep result) + if [ "result of test" != "$RES" ]; then + echo "synonym for $WORD should be 'result of test' but was '$RES'" + exit 1 + fi +} + +test_word foo +test_word bar +test_word test + +exit 0