corrected some mistakes in setup and cleanup of the test

This commit is contained in:
Philipp Dreher 2015-11-05 20:10:51 +01:00
parent 62805cdfa3
commit 9e2d2b1560
1 changed files with 6 additions and 4 deletions

View File

@ -1206,8 +1206,10 @@ static void test_show_without_item(CuTest *tc)
item_type *itype; item_type *itype;
item *i; item *i;
u = setup_name_cmd(); test_create_world();
ord = create_order(K_RESHOW, u->faction->locale, "");
u = test_create_unit(test_create_faction(test_create_race("human")), findregion(0, 0));
ord = create_order(K_RESHOW, u->faction->locale, "testname");
itype = it_get_or_create(rt_get_or_create("testitem")); itype = it_get_or_create(rt_get_or_create("testitem"));
i = i_new(itype, 1); i = i_new(itype, 1);
@ -1215,7 +1217,8 @@ static void test_show_without_item(CuTest *tc)
CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error21") != NULL); CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error21") != NULL);
test_clear_messages(u->faction); test_clear_messages(u->faction);
locale_setstring(get_locale("en"), "iteminfo::testitem", "testdescription"); locale_setstring(get_locale("de"), "testitem", "testname");
locale_setstring(get_locale("de"), "iteminfo::testitem", "testdescription");
reshow_cmd(u, ord); reshow_cmd(u, ord);
CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error21") == NULL); CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error21") == NULL);
CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error36") != NULL); CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error36") != NULL);
@ -1226,7 +1229,6 @@ static void test_show_without_item(CuTest *tc)
CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error21") == NULL); CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error21") == NULL);
CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error36") == NULL); CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error36") == NULL);
i_free(i);
free_order(ord); free_order(ord);
test_cleanup(); test_cleanup();
} }