forked from github/server
fix bug in tests introduced by previous merge
This commit is contained in:
parent
f2434346c9
commit
d6500f7e4f
|
@ -781,7 +781,7 @@ CuSuite *get_laws_suite(void)
|
||||||
SUITE_ADD_TEST(suite, test_force_leave_ships);
|
SUITE_ADD_TEST(suite, test_force_leave_ships);
|
||||||
SUITE_ADD_TEST(suite, test_force_leave_ships_on_ocean);
|
SUITE_ADD_TEST(suite, test_force_leave_ships_on_ocean);
|
||||||
SUITE_ADD_TEST(suite, test_peasant_luck_effect);
|
SUITE_ADD_TEST(suite, test_peasant_luck_effect);
|
||||||
DISABLE_TEST(suite, test_luck_message);
|
SUITE_ADD_TEST(suite, test_luck_message);
|
||||||
|
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <kernel/spellbook.h>
|
#include <kernel/spellbook.h>
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
|
#include <util/bsdstring.h>
|
||||||
#include <util/functions.h>
|
#include <util/functions.h>
|
||||||
#include <util/language.h>
|
#include <util/language.h>
|
||||||
#include <util/message.h>
|
#include <util/message.h>
|
||||||
|
@ -239,22 +240,24 @@ const message_type *register_msg(const char *type, int n_param, ...) {
|
||||||
|
|
||||||
void assert_messages(struct CuTest * tc, struct mlist *msglist, const message_type **types,
|
void assert_messages(struct CuTest * tc, struct mlist *msglist, const message_type **types,
|
||||||
int num_msgs, bool exact_match, ...) {
|
int num_msgs, bool exact_match, ...) {
|
||||||
|
char buf[100];
|
||||||
va_list args;
|
va_list args;
|
||||||
int found, argc = -1;
|
int found = 0, argc = -1;
|
||||||
struct message *msg;
|
struct message *msg;
|
||||||
bool match = true;
|
bool match = true;
|
||||||
|
|
||||||
va_start(args, exact_match);
|
va_start(args, exact_match);
|
||||||
|
|
||||||
while (msglist) {
|
while (msglist) {
|
||||||
|
msg = msglist->msg;
|
||||||
if (found >= num_msgs) {
|
if (found >= num_msgs) {
|
||||||
if (exact_match) {
|
if (exact_match) {
|
||||||
CuFail(tc, "too many messages");
|
slprintf(buf, sizeof(buf), "too many messages: %s", msg->type->name);
|
||||||
|
CuFail(tc, buf);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg = msglist->msg;
|
|
||||||
if (exact_match || match)
|
if (exact_match || match)
|
||||||
argc = va_arg(args, int);
|
argc = va_arg(args, int);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue