mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
Fix broken config-related test cases
This commit is contained in:
parent
aee96e53a3
commit
bcf473757d
|
@ -275,9 +275,7 @@ TEST_CASE("ConfigDefinition undeclared add/remove test", "[config]")
|
||||||
// ...then remove...
|
// ...then remove...
|
||||||
REQUIRE_NOTHROW(config.removeUndeclaredHandler("foo"));
|
REQUIRE_NOTHROW(config.removeUndeclaredHandler("foo"));
|
||||||
|
|
||||||
CHECK_THROWS_WITH(
|
CHECK_THROWS_WITH(config.addConfigValue("foo", "bar", "val"), "unrecognized section [foo]");
|
||||||
config.addConfigValue("foo", "bar", "val"),
|
|
||||||
"no declared section [foo]");
|
|
||||||
|
|
||||||
// ...then add again
|
// ...then add again
|
||||||
REQUIRE_NOTHROW(config.addUndeclaredHandler("foo", [&](std::string_view, std::string_view, std::string_view) {
|
REQUIRE_NOTHROW(config.addUndeclaredHandler("foo", [&](std::string_view, std::string_view, std::string_view) {
|
||||||
|
@ -308,7 +306,7 @@ TEST_CASE("ConfigDefinition undeclared handler wrong section", "[config]")
|
||||||
throw std::runtime_error("FAIL");
|
throw std::runtime_error("FAIL");
|
||||||
});
|
});
|
||||||
|
|
||||||
REQUIRE_THROWS_WITH(config.addConfigValue("argle", "bar", "val"), "no declared section [argle]");
|
REQUIRE_THROWS_WITH(config.addConfigValue("argle", "bar", "val"), "unrecognized section [argle]");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("ConfigDefinition undeclared handler duplicate names", "[config]")
|
TEST_CASE("ConfigDefinition undeclared handler duplicate names", "[config]")
|
||||||
|
|
|
@ -150,20 +150,3 @@ baz=1
|
||||||
)raw");
|
)raw");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("ConfigDefinition should print comments for missing keys")
|
|
||||||
{
|
|
||||||
// TODO: this currently fails: how to implement?
|
|
||||||
llarp::ConfigDefinition config;
|
|
||||||
|
|
||||||
config.addSectionComments("foo", {"foo section comment"});
|
|
||||||
config.addOptionComments("foo", "bar", {"foo bar option comment"});
|
|
||||||
|
|
||||||
std::string output = config.generateINIConfig();
|
|
||||||
|
|
||||||
CHECK(output == R"raw(# foo section comment
|
|
||||||
[foo]
|
|
||||||
|
|
||||||
# foo bar option comment
|
|
||||||
bar=
|
|
||||||
)raw");
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue