From aa42132243d83a56c231ff5d469c73ec34bc6138 Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 6 Jul 2017 16:52:52 +0200 Subject: [PATCH] Add tests for synonyms --- CMakeLists.txt | 1 + .../stardict-test_synonyms-2.4.2/test.dict.dz | Bin 0 -> 64 bytes tests/stardict-test_synonyms-2.4.2/test.idx | Bin 0 -> 13 bytes tests/stardict-test_synonyms-2.4.2/test.ifo | 7 ++++++ tests/stardict-test_synonyms-2.4.2/test.syn | Bin 0 -> 16 bytes tests/stardict-test_synonyms-2.4.2/test.xml | 18 ++++++++++++++ tests/t_synonyms | 22 ++++++++++++++++++ 7 files changed, 48 insertions(+) create mode 100644 tests/stardict-test_synonyms-2.4.2/test.dict.dz create mode 100644 tests/stardict-test_synonyms-2.4.2/test.idx create mode 100644 tests/stardict-test_synonyms-2.4.2/test.ifo create mode 100644 tests/stardict-test_synonyms-2.4.2/test.syn create mode 100644 tests/stardict-test_synonyms-2.4.2/test.xml create mode 100755 tests/t_synonyms 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 0000000000000000000000000000000000000000..c081b8940a4b7aa800fa81d81e01c3acd9f23629 GIT binary patch literal 64 zcmb2|=HRI)jf-Sr=3xkO + + + 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