Add support for .syn synonym files.#20
Merged
Dushistov merged 2 commits intoDushistov:masterfrom Jul 6, 2017
Merged
Conversation
Owner
|
Can you add some simple dictionary with |
Contributor
Author
|
ok, added three tests, seems to work fine, I tried with some larger local dictionaries too ;) |
Dushistov
requested changes
Jul 6, 2017
src/stardict_lib.cpp
Outdated
| tmpstr = (gchar *)g_memdup(p2, p3-p2+1); | ||
| tmpstr[p3-p2] = '\0'; | ||
| syn_wordcount = atol(tmpstr); | ||
| g_free(tmpstr); |
Owner
There was a problem hiding this comment.
I simplify parsing of integers, so to fix build you need:
syn_wordcount = atol(std::string(p2, p3-p2).c_str());
tests/t_synonyms
Outdated
|
|
||
| unset SDCV_PAGER | ||
|
|
||
| RES=$($SDCV -n --data-dir "$TEST_DIR" foo | grep result) |
Owner
There was a problem hiding this comment.
You could move repeated pattern into sh function, for example:
function test_word() {
WORD="$1"
echo "Test ${WORD}"
RES=$($SDCV -n -u "Test synonyms" --data-dir "$TEST_DIR" "${WORD}" | grep result)
if [ "result" != "$RES" ]; then
echo "synonym for "${WORD}" should be result but was \"${RES}\"" >&2
exit 1
fi
}
test_word "foo"
test_word "bar"
test_word "test"also to make possible code to run on machine with dictionaries with "test" word into it,
please add -u "Test synonyms" into sdcv arguments
cc601f6 to
29b4d83
Compare
Contributor
Author
|
I hope I have addressed all the changes. |
Owner
|
Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8.