TEST_FIXTURE(EnchantBrokerSetErrorTests, SetErrorMessageOnProvider_InvalidUtf8ErrorMessage_NoErrorSet) { enchant_provider_set_error(provider, "\xa5\xf1\x08"); CHECK_EQUAL(std::string(), GetErrorMessage()); }
TEST_FIXTURE(EnchantBrokerSetErrorTests, SetErrorMessageOnProvider_NullError_NoErrorSet) { enchant_provider_set_error(provider, NULL); CHECK_EQUAL(std::string(), GetErrorMessage()); }
///////////////////////////////////////////////////////////////////////////// // Test Error Conditions TEST_FIXTURE(EnchantBrokerSetErrorTests, SetErrorMessageOnProvider_NullProvider_NoErrorSet) { enchant_provider_set_error(NULL, "Error message to display"); CHECK_EQUAL(std::string(), GetErrorMessage()); }
TEST_FIXTURE(EnchantBrokerSetErrorTests, SetErrorMessageOnProvider) { std::string expectedErrorMessage("Error message to display"); enchant_provider_set_error(provider, expectedErrorMessage.c_str()); CHECK_EQUAL(expectedErrorMessage, GetErrorMessage()); }
TEST_FIXTURE(EnchantBrokerSetErrorTests, SetErrorMessageOnProvider_MessageCopied) { std::string expectedErrorMessage("Error message to display"); enchant_provider_set_error(provider, expectedErrorMessage.c_str()); expectedErrorMessage[0] = 'e'; CHECK(expectedErrorMessage != GetErrorMessage()); }
static EnchantDict * voikko_provider_request_dict (EnchantProvider * me, const char *const tag) { EnchantDict *dict; const char * voikko_error; int voikko_handle; /* Only Finnish is supported at the moment */ if (strncmp(tag, "fi_FI", 6) != 0 && strncmp(tag, "fi", 3) != 0) return NULL; voikko_error = voikko_init(&voikko_handle, "fi_FI", 0); if (voikko_error) { enchant_provider_set_error(me, voikko_error); return NULL; } dict = g_new0 (EnchantDict, 1); dict->user_data = (void *)(long) voikko_handle; dict->check = voikko_dict_check; dict->suggest = voikko_dict_suggest; return dict; }