mirror of
https://github.com/Dushistov/sdcv.git
synced 2025-12-15 17:31:56 +00:00
Add tests for synonyms
This commit is contained in:
@@ -144,6 +144,7 @@ if (BUILD_TESTS)
|
|||||||
|
|
||||||
add_sdcv_shell_test(t_list)
|
add_sdcv_shell_test(t_list)
|
||||||
add_sdcv_shell_test(t_use)
|
add_sdcv_shell_test(t_use)
|
||||||
|
add_sdcv_shell_test(t_synonyms)
|
||||||
add_sdcv_shell_test(t_interactive)
|
add_sdcv_shell_test(t_interactive)
|
||||||
add_sdcv_shell_test(t_utf8output)
|
add_sdcv_shell_test(t_utf8output)
|
||||||
add_sdcv_shell_test(t_utf8input)
|
add_sdcv_shell_test(t_utf8input)
|
||||||
|
|||||||
BIN
tests/stardict-test_synonyms-2.4.2/test.dict.dz
Normal file
BIN
tests/stardict-test_synonyms-2.4.2/test.dict.dz
Normal file
Binary file not shown.
BIN
tests/stardict-test_synonyms-2.4.2/test.idx
Normal file
BIN
tests/stardict-test_synonyms-2.4.2/test.idx
Normal file
Binary file not shown.
7
tests/stardict-test_synonyms-2.4.2/test.ifo
Normal file
7
tests/stardict-test_synonyms-2.4.2/test.ifo
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
StarDict's dict ifo file
|
||||||
|
version=2.4.2
|
||||||
|
bookname=Test synonyms
|
||||||
|
wordcount=1
|
||||||
|
synwordcount=2
|
||||||
|
idxfilesize=13
|
||||||
|
sametypesequence=m
|
||||||
BIN
tests/stardict-test_synonyms-2.4.2/test.syn
Normal file
BIN
tests/stardict-test_synonyms-2.4.2/test.syn
Normal file
Binary file not shown.
18
tests/stardict-test_synonyms-2.4.2/test.xml
Normal file
18
tests/stardict-test_synonyms-2.4.2/test.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<stardict xmlns:xi="http://www.w3.org/2003/XInclude">
|
||||||
|
<info>
|
||||||
|
<version>2.4.2</version>
|
||||||
|
<bookname>Test synonyms</bookname>
|
||||||
|
<author></author>
|
||||||
|
<email></email>
|
||||||
|
<website></website>
|
||||||
|
<description></description>
|
||||||
|
<date></date>
|
||||||
|
<dicttype></dicttype>
|
||||||
|
</info>
|
||||||
|
<article><key>test</key><synonym>foo</synonym><synonym>bar</synonym>
|
||||||
|
<definition type="m">
|
||||||
|
<![CDATA[result of test]]>
|
||||||
|
</definition>
|
||||||
|
</article>
|
||||||
|
</stardict>
|
||||||
22
tests/t_synonyms
Executable file
22
tests/t_synonyms
Executable file
@@ -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
|
||||||
Reference in New Issue
Block a user