aboutsummaryrefslogtreecommitdiff
path: root/paludis/util/config_file_TEST.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/util/config_file_TEST.cc')
-rw-r--r--paludis/util/config_file_TEST.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/paludis/util/config_file_TEST.cc b/paludis/util/config_file_TEST.cc
index 4c0376b8e..d6c102bc6 100644
--- a/paludis/util/config_file_TEST.cc
+++ b/paludis/util/config_file_TEST.cc
@@ -56,6 +56,11 @@ namespace
{
return f.get(s);
}
+
+ std::string concatenate(const KeyValueConfigFile &, const std::string &, const std::string & prev, const std::string & value)
+ {
+ return prev + value;
+ }
}
TEST(LineConfigFile, Works)
@@ -238,6 +243,20 @@ TEST(KeyValueConfigFile, Defaults)
EXPECT_EQ("cow", ff.get("y"));
}
+TEST(KeyValueConfigFile, DefaultsAndTransformations)
+{
+ auto predef(std::make_shared<Map<std::string, std::string>>());
+ predef->insert("magic", "xyzzy");
+
+ std::stringstream d_s;
+ d_s << "magic=plugh" << std::endl;
+ KeyValueConfigFile ff(d_s, { },
+ std::bind(&predefined, predef, std::placeholders::_1, std::placeholders::_2),
+ &concatenate);
+
+ EXPECT_EQ("xyzzyplugh", ff.get("magic"));
+}
+
TEST(KeyValueConfigFile, Source)
{
std::stringstream d_s;