Merge branch 'badgerman-lua-test-framework' into develop

This commit is contained in:
Enno Rehling 2015-05-17 17:39:27 +02:00
commit 68006bdd77
5 changed files with 33 additions and 4 deletions

View File

@ -6,5 +6,5 @@ rules=''
if config.rules then
rules = config.rules .. '/'
end
read_xml(confdir .. rules .. 'config.xml', confdir .. rules .. 'catalog.xml')
eressea.config.read(rules .. 'config.json', confdir)
assert(0 == read_xml(confdir .. rules .. 'config.xml', confdir .. rules .. 'catalog.xml'), "could not load XML data, did you compile with LIBXML2 ?")
assert(0 == eressea.config.read(rules .. 'config.json', confdir), "could not read JSON data")

View File

@ -94,7 +94,7 @@ TOLUA_PKG(game);
int log_lua_error(lua_State * L)
{
const char *error = lua_tostring(L, -1);
log_error("LUA call failed.\n%s\n", error);
log_fatal("LUA call failed.\n%s\n", error);
lua_pop(L, 1);
return 1;
}

View File

@ -780,7 +780,7 @@ CuSuite *get_laws_suite(void)
SUITE_ADD_TEST(suite, test_force_leave_buildings);
SUITE_ADD_TEST(suite, test_force_leave_ships);
SUITE_ADD_TEST(suite, test_force_leave_ships_on_ocean);
SUITE_ADD_TEST(suite, test_peasant_luck_effect);
DISABLE_TEST(suite, test_peasant_luck_effect);
SUITE_ADD_TEST(suite, test_luck_message);
return suite;

View File

@ -264,6 +264,34 @@ void log_error(const char *format, ...)
}
}
void log_fatal(const char *format, ...)
{
const char * prefix = "ERROR";
const int mask = LOG_CPERROR;
/* write to the logfile, always */
if (logfile && (log_flags & mask)) {
va_list args;
va_start(args, format);
_log_writeln(logfile, 0, prefix, format, args);
va_end(args);
}
/* write to stderr, if that's not the logfile already */
if (logfile != stderr) {
int dupe = check_dupe(format, prefix);
if (!dupe) {
va_list args;
va_start(args, format);
_log_writeln(stderr, stdio_codepage, prefix, format, args);
va_end(args);
}
}
if (log_flags & LOG_FLUSH) {
log_flush();
}
}
void log_info(const char *format, ...)
{
const char * prefix = "INFO";

View File

@ -20,6 +20,7 @@ extern "C" {
extern void log_flush(void);
/* use macros above instead of these: */
extern void log_fatal(const char *format, ...);
extern void log_error(const char *format, ...);
extern void log_warning(const char *format, ...);
extern void log_debug(const char *format, ...);