mirror of
https://github.com/falk-werner/webfused
synced 2024-10-27 20:44:08 +00:00
log syntax errors
This commit is contained in:
parent
7e70d396f1
commit
d8670b742c
@ -84,8 +84,16 @@ wfd_config_load_file(
|
||||
if (CONFIG_TRUE == rc)
|
||||
{
|
||||
result = wfd_config_load(&config);
|
||||
config_destroy(&config);
|
||||
}
|
||||
else
|
||||
{
|
||||
WFD_ERROR("failed to load config: %s: %d: %s",
|
||||
config_error_file(&config),
|
||||
config_error_line(&config),
|
||||
config_error_text(&config));
|
||||
}
|
||||
config_destroy(&config);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -102,8 +110,15 @@ wfd_config_load_string(
|
||||
if (CONFIG_TRUE == rc)
|
||||
{
|
||||
result = wfd_config_load(&config);
|
||||
config_destroy(&config);
|
||||
}
|
||||
else
|
||||
{
|
||||
WFD_ERROR("failed to load config: %d: %s",
|
||||
config_error_line(&config),
|
||||
config_error_text(&config));
|
||||
}
|
||||
config_destroy(&config);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -31,6 +31,18 @@ TEST(config, minimal_config)
|
||||
wfd_config_dispose(config);
|
||||
}
|
||||
|
||||
TEST(config, invalid_config)
|
||||
{
|
||||
MockLogger logger;
|
||||
EXPECT_CALL(logger, log(WFD_LOGLEVEL_ERROR, _, _)).Times(1);
|
||||
EXPECT_CALL(logger, onclose()).Times(1);
|
||||
|
||||
char const syntax_error[] = "version.major = 1\n";
|
||||
|
||||
struct wfd_config * config = wfd_config_load_string(syntax_error);
|
||||
ASSERT_EQ(nullptr, config);
|
||||
}
|
||||
|
||||
TEST(config, invalid_major_version_too_low)
|
||||
{
|
||||
MockLogger logger;
|
||||
|
Loading…
Reference in New Issue
Block a user