forked from github/server
add a failing test for bug 1685
This commit is contained in:
parent
4dc94323d8
commit
2e3c0db02a
|
@ -296,6 +296,31 @@ static void test_give_denied_by_rules(CuTest * tc) {
|
|||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_give_invalid_target(CuTest *tc) {
|
||||
// bug https://bugs.eressea.de/view.php?id=1685
|
||||
struct give env;
|
||||
order *ord;
|
||||
struct locale * lang;
|
||||
|
||||
test_cleanup();
|
||||
env.f1 = test_create_faction(0);
|
||||
env.f2 = 0;
|
||||
setup_give(&env);
|
||||
|
||||
i_change(&env.src->items, env.itype, 10);
|
||||
lang = get_or_create_locale("test");
|
||||
env.f1->locale = lang;
|
||||
locale_setstring(lang, "KRAEUTER", "HERBS");
|
||||
init_locale(lang);
|
||||
ord = create_order(K_GIVE, lang, "## HERBS");
|
||||
assert(ord);
|
||||
|
||||
give_cmd(env.src, ord);
|
||||
CuAssertIntEquals(tc, 10, i_get(env.src->items, env.itype));
|
||||
CuAssertPtrNotNull(tc, test_find_messagetype(env.f1->msgs, "feedback_unit_not_found"));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
CuSuite *get_give_suite(void)
|
||||
{
|
||||
CuSuite *suite = CuSuiteNew();
|
||||
|
@ -315,5 +340,6 @@ CuSuite *get_give_suite(void)
|
|||
SUITE_ADD_TEST(suite, test_give_herbs);
|
||||
SUITE_ADD_TEST(suite, test_give_okay);
|
||||
SUITE_ADD_TEST(suite, test_give_denied_by_rules);
|
||||
SUITE_ADD_TEST(suite, test_give_invalid_target);
|
||||
return suite;
|
||||
}
|
||||
|
|
|
@ -1025,6 +1025,16 @@ typedef struct param {
|
|||
char *data;
|
||||
} param;
|
||||
|
||||
void free_params(struct param **pp) {
|
||||
while (*pp) {
|
||||
param *p = *pp;
|
||||
free(p->name);
|
||||
free(p->data);
|
||||
*pp = p->next;
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
|
||||
const char *get_param(const struct param *p, const char *key)
|
||||
{
|
||||
while (p != NULL) {
|
||||
|
|
|
@ -277,6 +277,7 @@ extern "C" {
|
|||
int get_param_int(const struct param *p, const char *key, int def);
|
||||
int check_param(const struct param *p, const char *key, const char *searchvalue);
|
||||
float get_param_flt(const struct param *p, const char *key, float def);
|
||||
void free_params(struct param **pp);
|
||||
|
||||
bool ExpensiveMigrants(void);
|
||||
int NMRTimeout(void);
|
||||
|
|
|
@ -73,6 +73,7 @@ void test_cleanup(void)
|
|||
free_resources();
|
||||
global.functions.maintenance = NULL;
|
||||
global.functions.wage = NULL;
|
||||
free_params(&global.parameters);
|
||||
default_locale = 0;
|
||||
free_locales();
|
||||
free_spells();
|
||||
|
|
Loading…
Reference in New Issue