diff options
author | Eric Albright <eric_albright@sil.org> | 2008-02-27 03:20:26 +0000 |
---|---|---|
committer | Eric Albright <eric_albright@sil.org> | 2008-02-27 03:20:26 +0000 |
commit | 0e670dbb9110336ad4c89338bb2324b24ce08089 (patch) | |
tree | fc59e6fe445997b5f04dbc57881b7e554ae7a3d9 | |
parent | 067380bf6851abe79f568d0b88bb5344d6b05254 (diff) | |
download | enchant-0e670dbb9110336ad4c89338bb2324b24ce08089.tar.gz |
Make aspell provider not set an error message if it cannot find a dictionary when requested
git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/trunk@22964 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6
-rw-r--r-- | src/aspell/aspell_provider.c | 1 | ||||
-rw-r--r-- | unittests/enchant_providers/Provider/provider_request_dict.cpp | 70 |
2 files changed, 70 insertions, 1 deletions
diff --git a/src/aspell/aspell_provider.c b/src/aspell/aspell_provider.c index ee1073d..4005cf1 100644 --- a/src/aspell/aspell_provider.c +++ b/src/aspell/aspell_provider.c @@ -191,7 +191,6 @@ aspell_provider_request_dict (EnchantProvider * me, const char *const tag) if (pspell_error_number (spell_error) != 0) { - enchant_provider_set_error (me, pspell_error_message(spell_error)); return NULL; } diff --git a/unittests/enchant_providers/Provider/provider_request_dict.cpp b/unittests/enchant_providers/Provider/provider_request_dict.cpp new file mode 100644 index 0000000..ab5e849 --- /dev/null +++ b/unittests/enchant_providers/Provider/provider_request_dict.cpp @@ -0,0 +1,70 @@ +/* Copyright (c) 2008 Eric Scott Albright
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <UnitTest++.h>
+#include <enchant-provider.h>
+
+#include "../unittest_enchant_providers.h"
+
+struct ProviderRequestDictionary_TestFixture
+{
+ EnchantProvider* _provider;
+
+ EnchantDict* _dict;
+ //Setup
+ ProviderRequestDictionary_TestFixture()
+ {
+ _provider = GetProviderForTests();
+ }
+ //Teardown
+ ~ProviderRequestDictionary_TestFixture()
+ {
+ if (_dict && _provider->dispose_dict)
+ {
+ _provider->dispose_dict(_provider, _dict);
+ }
+ }
+};
+
+// request_dict is optional
+
+/////////////////////////////////////////////////////////////////////////////
+// Test Normal Operation
+
+TEST_FIXTURE(ProviderRequestDictionary_TestFixture,
+ ProviderRequestDictionary_ProviderDoesNotHave_ReturnsNull)
+{
+ if (_provider->request_dict)
+ {
+ _dict = (*_provider->request_dict) (_provider, "zxx"); /*zxx is no linguistic content*/
+ CHECK_EQUAL((void*)NULL, _dict);
+ }
+}
+
+TEST_FIXTURE(ProviderRequestDictionary_TestFixture,
+ ProviderRequestDictionary_ProviderDoesNotHave_ProviderDoesNotSetError)
+{
+ if (_provider->request_dict)
+ {
+ _dict = (*_provider->request_dict) (_provider, "zxx"); /*zxx is no linguistic content*/
+ CHECK_EQUAL((void*)NULL, GetErrorMessage(_provider));
+ }
+}
|