mirror of
https://github.com/Dushistov/sdcv.git
synced 2025-12-15 17:31:56 +00:00
Add -e for exact searches (no fuzzy matches).
Only exact matches (or synonyms) are returned for simple searches.
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
StarDict's dict ifo file
|
||||
version=2.4.2
|
||||
bookname=Test synonyms
|
||||
wordcount=1
|
||||
wordcount=2
|
||||
synwordcount=2
|
||||
idxfilesize=13
|
||||
idxfilesize=32
|
||||
sametypesequence=m
|
||||
|
||||
@@ -15,4 +15,9 @@
|
||||
<![CDATA[result of test]]>
|
||||
</definition>
|
||||
</article>
|
||||
<article><key>testawordy</key>
|
||||
<definition type="m">
|
||||
<![CDATA[word that ends in y to test with fuzzy search in -ied]]>
|
||||
</definition>
|
||||
</article>
|
||||
</stardict>
|
||||
|
||||
24
tests/t_exact
Executable file
24
tests/t_exact
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
SDCV="$1"
|
||||
TEST_DIR="$2"
|
||||
|
||||
unset SDCV_PAGER
|
||||
|
||||
test_word() {
|
||||
WORD=$1
|
||||
EXPECTED=$2
|
||||
TAG=$3
|
||||
RES=$($SDCV -e -n --data-dir "$TEST_DIR" -u "Test synonyms" $WORD | grep "$TAG")
|
||||
if [ "$EXPECTED" != "$RES" ]; then
|
||||
echo "synonym for $WORD should be '$EXPECTED' but was '$RES'"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
test_word testawordies "Nothing similar to testawordies, sorry :(" "Nothing similar"
|
||||
test_word testawordy "word that ends in y to test with fuzzy search in -ied" "fuzzy"
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user