m_origins.emplace(key, origin);
}
+
+void
+Config::check_key_tables_consistency()
+{
+ for (const auto& item : k_env_variable_table) {
+ if (k_config_key_table.find(item.second) == k_config_key_table.end()) {
+ throw Error(fmt::format(
+ "env var {} mapped to {} which is missing from k_config_key_table",
+ item.first,
+ item.second));
+ }
+ }
+}
const std::string& key,
const std::string& value);
+ // Called from unit tests.
+ static void check_key_tables_consistency();
+
private:
std::string m_primary_config_path;
std::string m_secondary_config_path;
}
}
-// TODO Test that values in k_env_variable_table map to keys in
-// k_config_item_table.;
+TEST_CASE("Check key tables consistency")
+{
+ CHECK_NOTHROW(Config::check_key_tables_consistency());
+}