summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2025-10-07 21:46:03 +0200
committerJoel Klinghed <the_jk@spawned.biz>2025-10-19 00:13:47 +0200
commit3a002fb9c23fc9a6384bc1b30a8e364924bb574e (patch)
tree7cfb59964bc20bbb14d157426b2aad4481deb90d /test
parent62a4abb9bf6551417130c3c6f9bba147930895ef (diff)
cfg: Make load less magic
Don't try to guess from name, instead, have one method for only loading one config from a file (that might be relative) and loading a config from config dirs using a name (that might contain slash).
Diffstat (limited to 'test')
-rw-r--r--test/cfg.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/cfg.cc b/test/cfg.cc
index 80ebba9..0c27989 100644
--- a/test/cfg.cc
+++ b/test/cfg.cc
@@ -22,7 +22,7 @@ class ConfigTest : public TestEnv {
TEST_F(ConfigTest, empty) {
auto does_not_exist = dir_.path() / "does-not-exist";
std::vector<std::string> errors;
- auto cfg = cfg::Config::load(does_not_exist.string(), errors);
+ auto cfg = cfg::load_one(does_not_exist, errors);
ASSERT_TRUE(cfg);
EXPECT_EQ(1, errors.size());
@@ -46,7 +46,7 @@ TEST_F(ConfigTest, values) {
<< "i2 = -12313\n";
}
std::vector<std::string> errors;
- auto cfg = cfg::Config::load(file.string(), errors);
+ auto cfg = cfg::load_one(file, errors);
ASSERT_TRUE(cfg);
EXPECT_EQ(0, errors.size());
@@ -90,7 +90,7 @@ TEST_F(ConfigTest, bools) {
<< "key5=ja\n";
}
std::vector<std::string> errors;
- auto cfg = cfg::Config::load(file.string(), errors);
+ auto cfg = cfg::load_one(file, errors);
ASSERT_TRUE(cfg);
EXPECT_EQ(0, errors.size());
@@ -110,7 +110,7 @@ TEST_F(ConfigTest, errors) {
<< "key=duplicate\n";
}
std::vector<std::string> errors;
- auto cfg = cfg::Config::load(file.string(), errors);
+ auto cfg = cfg::load_one(file, errors);
ASSERT_TRUE(cfg);
EXPECT_EQ(2, errors.size());
}
@@ -137,7 +137,7 @@ TEST_F(ConfigTest, merge) {
<< "key3 = value3";
}
std::vector<std::string> errors;
- auto cfg = cfg::Config::load("file", errors);
+ auto cfg = cfg::load_all("file", errors);
ASSERT_TRUE(cfg);
EXPECT_EQ(0, errors.size());
@@ -173,7 +173,7 @@ TEST_F(ConfigTest, merge_errors) {
out << "invalid line";
}
std::vector<std::string> errors;
- auto cfg = cfg::Config::load("file", errors);
+ auto cfg = cfg::load_all("file", errors);
ASSERT_TRUE(cfg);
EXPECT_EQ(1, errors.size());