diff options
author | Eric Albright <eric_albright@sil.org> | 2007-11-29 08:16:03 +0000 |
---|---|---|
committer | Eric Albright <eric_albright@sil.org> | 2007-11-29 08:16:03 +0000 |
commit | ecd6723df72585fba3d269aebc2e28fd057dd74a (patch) | |
tree | 67a852099899c4d144cadb296bdca0fc368ea981 | |
parent | 828e6fb695329011d2ae41b3492fde8e479891b1 (diff) | |
download | enchant-ecd6723df72585fba3d269aebc2e28fd057dd74a.tar.gz |
Handle case where all suggestions are excluded
git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/trunk@22360 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6
-rw-r--r-- | src/enchant.c | 5 | ||||
-rw-r--r-- | unittests/dictionary/enchant_dict_suggest_tests.cpp | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/enchant.c b/src/enchant.c index bbcdc65..266c89c 100644 --- a/src/enchant.c +++ b/src/enchant.c @@ -799,6 +799,11 @@ enchant_dict_suggest (EnchantDict * dict, const char *const word, n_suggs = enchant_dict_merge_suggestions(dict, suggs, n_suggs, pwl_suggs, n_pwl_suggs); + if(n_suggs == 0) + { + g_free(suggs); + suggs = NULL; + } } else { diff --git a/unittests/dictionary/enchant_dict_suggest_tests.cpp b/unittests/dictionary/enchant_dict_suggest_tests.cpp index a73255a..3c486c9 100644 --- a/unittests/dictionary/enchant_dict_suggest_tests.cpp +++ b/unittests/dictionary/enchant_dict_suggest_tests.cpp @@ -292,6 +292,16 @@ TEST_FIXTURE(EnchantDictionarySuggest_TestFixture, CHECK_ARRAY_EQUAL(GetExpectedSuggestions("helo"), suggestions, std::min((size_t)4,cSuggestions));
}
+TEST_FIXTURE(EnchantDictionarySuggest_TestFixture,
+ EnchantDictionarySuggest_SuggestionExcluded_Null)
+{
+ suggestBehavior = returnFianceNfc;
+ RemoveWordFromDictionary(Convert(L"fianc\xe9")); // u00e9 = Latin small letter e with acute
+
+ _suggestions = enchant_dict_suggest(_dict, "fiance", -1, NULL);
+ CHECK(!_suggestions);
+}
+
TEST_FIXTURE(EnchantDictionarySuggest_TestFixture,
EnchantDictionarySuggest_HasPreviousError_ErrorCleared)
{
|