forked from github/server
fix tests that relied on translation structures being statically cached.
clean up static cache, add test for German imperative (WIP)
This commit is contained in:
parent
96d5544b1f
commit
f788f19f6c
4 changed files with 17 additions and 3 deletions
|
@ -32,6 +32,7 @@ static void test_parse_order(CuTest *tc) {
|
||||||
struct locale * lang = get_or_create_locale("en");
|
struct locale * lang = get_or_create_locale("en");
|
||||||
|
|
||||||
locale_setstring(lang, "keyword::move", "MOVE");
|
locale_setstring(lang, "keyword::move", "MOVE");
|
||||||
|
init_keyword(lang, K_MOVE, "MOVE");
|
||||||
ord = parse_order("MOVE NORTH", lang);
|
ord = parse_order("MOVE NORTH", lang);
|
||||||
CuAssertPtrNotNull(tc, ord);
|
CuAssertPtrNotNull(tc, ord);
|
||||||
CuAssertIntEquals(tc, K_MOVE, getkeyword(ord));
|
CuAssertIntEquals(tc, K_MOVE, getkeyword(ord));
|
||||||
|
|
|
@ -19,6 +19,18 @@ static void test_init_keywords(CuTest *tc) {
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_infinitive(CuTest *tc) {
|
||||||
|
struct locale *lang;
|
||||||
|
test_cleanup();
|
||||||
|
|
||||||
|
lang = get_or_create_locale("de");
|
||||||
|
init_keyword(lang, K_STUDY, "LERNEN");
|
||||||
|
CuAssertIntEquals(tc, K_STUDY, get_keyword("LERN", lang));
|
||||||
|
CuAssertIntEquals(tc, K_STUDY, get_keyword("LERNE", lang));
|
||||||
|
CuAssertIntEquals(tc, K_STUDY, get_keyword("LERNEN", lang));
|
||||||
|
test_cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
static void test_init_keyword(CuTest *tc) {
|
static void test_init_keyword(CuTest *tc) {
|
||||||
struct locale *lang;
|
struct locale *lang;
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
|
@ -76,6 +88,7 @@ static void test_get_shortest_match(CuTest *tc) {
|
||||||
CuSuite *get_keyword_suite(void)
|
CuSuite *get_keyword_suite(void)
|
||||||
{
|
{
|
||||||
CuSuite *suite = CuSuiteNew();
|
CuSuite *suite = CuSuiteNew();
|
||||||
|
SUITE_ADD_TEST(suite, test_infinitive);
|
||||||
SUITE_ADD_TEST(suite, test_init_keyword);
|
SUITE_ADD_TEST(suite, test_init_keyword);
|
||||||
SUITE_ADD_TEST(suite, test_init_keywords);
|
SUITE_ADD_TEST(suite, test_init_keywords);
|
||||||
SUITE_ADD_TEST(suite, test_findkeyword);
|
SUITE_ADD_TEST(suite, test_findkeyword);
|
||||||
|
@ -83,4 +96,3 @@ CuSuite *get_keyword_suite(void)
|
||||||
SUITE_DISABLE_TEST(suite, test_get_keyword_default);
|
SUITE_DISABLE_TEST(suite, test_get_keyword_default);
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ static void test_init_skills(CuTest *tc) {
|
||||||
|
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
lang = get_or_create_locale("de");
|
lang = get_or_create_locale("de");
|
||||||
locale_setstring(lang, "alchemy", "Alchemie");
|
// locale_setstring(lang, "alchemy", "Alchemie");
|
||||||
init_skills(lang);
|
init_skill(lang, SK_ALCHEMY, "Alchemie");
|
||||||
CuAssertIntEquals(tc, SK_ALCHEMY, get_skill("alchemie", lang));
|
CuAssertIntEquals(tc, SK_ALCHEMY, get_skill("alchemie", lang));
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,4 +261,5 @@ void free_locales(void)
|
||||||
free(locales);
|
free(locales);
|
||||||
locales = next;
|
locales = next;
|
||||||
}
|
}
|
||||||
|
memset(lstrs, 0, sizeof(lstrs)); // TODO: does this data need to be free'd?
|
||||||
}
|
}
|
Loading…
Reference in a new issue