reduce "translation not found" warnings in tests.

This commit is contained in:
Enno Rehling 2017-03-10 21:43:36 +01:00
parent be0b54494e
commit fe95ddafa1
2 changed files with 16 additions and 17 deletions

View File

@ -52,7 +52,7 @@ static void test_rename_building(CuTest * tc)
building_type *btype; building_type *btype;
test_setup(); test_setup();
test_create_locale();
btype = test_create_buildingtype("castle"); btype = test_create_buildingtype("castle");
r = test_create_region(0, 0, 0); r = test_create_region(0, 0, 0);
b = new_building(btype, r, default_locale); b = new_building(btype, r, default_locale);
@ -74,7 +74,7 @@ static void test_rename_building_twice(CuTest * tc)
building_type *btype; building_type *btype;
test_setup(); test_setup();
test_create_locale();
btype = test_create_buildingtype("castle"); btype = test_create_buildingtype("castle");
r = test_create_region(0, 0, 0); r = test_create_region(0, 0, 0);
b = new_building(btype, r, default_locale); b = new_building(btype, r, default_locale);
@ -98,7 +98,7 @@ static void test_contact(CuTest * tc)
ally *al; ally *al;
test_setup(); test_setup();
test_create_locale();
btype = test_create_buildingtype("castle"); btype = test_create_buildingtype("castle");
r = test_create_region(0, 0, 0); r = test_create_region(0, 0, 0);
b = new_building(btype, r, default_locale); b = new_building(btype, r, default_locale);
@ -127,9 +127,9 @@ static void test_enter_building(CuTest * tc)
race * rc; race * rc;
test_setup(); test_setup();
test_create_locale();
r = test_create_region(0, 0, 0); r = test_create_region(0, 0, 0);
rc = rc_get_or_create("human"); rc = test_create_race("human");
u = test_create_unit(test_create_faction(rc), r); u = test_create_unit(test_create_faction(rc), r);
b = test_create_building(r, test_create_buildingtype("castle")); b = test_create_building(r, test_create_buildingtype("castle"));
@ -1270,7 +1270,6 @@ static void test_show_without_item(CuTest *tc)
unit *u; unit *u;
order *ord; order *ord;
item_type *itype; item_type *itype;
item *i;
struct locale *loc; struct locale *loc;
test_setup(); test_setup();
@ -1283,26 +1282,26 @@ static void test_show_without_item(CuTest *tc)
f = test_create_faction(test_create_race("human")); f = test_create_faction(test_create_race("human"));
u = test_create_unit(f, r); u = test_create_unit(f, r);
itype = it_get_or_create(rt_get_or_create("testitem"));
ord = create_order(K_RESHOW, f->locale, "testname"); ord = create_order(K_RESHOW, f->locale, "testname");
itype = it_get_or_create(rt_get_or_create("testitem"));
i = i_new(itype, 1);
reshow_cmd(u, ord); reshow_cmd(u, ord);
CuAssertTrue(tc, test_find_messagetype(f->msgs, "error21") != NULL); CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error21"));
test_clear_messages(f); test_clear_messages(f);
locale_setstring(loc, "testitem", "testname"); locale_setstring(loc, "testitem", "testname");
locale_setstring(loc, "iteminfo::testitem", "testdescription"); locale_setstring(loc, "iteminfo::testitem", "testdescription");
reshow_cmd(u, ord); reshow_cmd(u, ord);
CuAssertTrue(tc, test_find_messagetype(f->msgs, "error21") == NULL); CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error21"));
CuAssertTrue(tc, test_find_messagetype(f->msgs, "error36") != NULL); CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error36"));
test_clear_messages(f); test_clear_messages(f);
i_add(&(u->items), i); i_add(&(u->items), i_new(itype, 1));
reshow_cmd(u, ord); reshow_cmd(u, ord);
CuAssertTrue(tc, test_find_messagetype(f->msgs, "error21") == NULL); CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error21"));
CuAssertTrue(tc, test_find_messagetype(f->msgs, "error36") == NULL); CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error36"));
test_clear_messages(f); test_clear_messages(f);
free_order(ord); free_order(ord);

View File

@ -264,10 +264,10 @@ struct drift_fixture {
void setup_drift (struct drift_fixture *fix) { void setup_drift (struct drift_fixture *fix) {
test_setup(); test_setup();
test_create_locale();
config_set("rules.ship.storms", "0"); config_set("rules.ship.storms", "0");
test_create_shiptype("drifter"); fix->st_boat = test_create_shiptype("boat");
fix->st_boat = st_get_or_create("drifter");
fix->st_boat->cabins = 20000; fix->st_boat->cabins = 20000;
test_create_ocean(0, 0); test_create_ocean(0, 0);