there is a memory leak in test_long_order_hungry, but the root cause lies deeper

This commit is contained in:
Enno Rehling 2015-10-14 12:51:45 +02:00
parent 469d312339
commit 4fc5ac7740
3 changed files with 6 additions and 2 deletions

View File

@ -1611,6 +1611,8 @@ void set_default_order(int kwd) {
default_keyword = (keyword_t)kwd; default_keyword = (keyword_t)kwd;
} }
// TODO: outside of tests, default_keyword is never used, why is this here?
// see also test_long_order_hungry
order *default_order(const struct locale *lang) order *default_order(const struct locale *lang)
{ {
static int usedefault = 1; static int usedefault = 1;

View File

@ -33,9 +33,10 @@ static void test_curse(CuTest * tc)
cid = c->no; cid = c->no;
result = findcurse(cid); result = findcurse(cid);
CuAssertPtrEquals(tc, c, result); CuAssertPtrEquals(tc, c, result);
destroy_curse(c); a_remove(&attrs, attrs);
result = findcurse(cid); result = findcurse(cid);
CuAssertPtrEquals(tc, NULL, result); CuAssertPtrEquals(tc, NULL, result);
test_cleanup();
} }
typedef struct { typedef struct {

View File

@ -999,7 +999,8 @@ static void test_long_order_buy_cast(CuTest *tc) {
} }
static void test_long_order_hungry(CuTest *tc) { static void test_long_order_hungry(CuTest *tc) {
// TODO: write more tests // FIXME: set_default_order is a test-only function, this is a bad test.
// see also default_order
unit *u; unit *u;
test_cleanup(); test_cleanup();
set_param(&global.parameters, "hunger.long", "1"); set_param(&global.parameters, "hunger.long", "1");