TEST_F(LUATest, testKeyValueMap) { LUA lua; const char *buf = "settings = { a = false, b = true, c = 1, d = \"foo\", }"; ASSERT_TRUE(lua.loadBuffer(buf, "testGlobal")); ASSERT_EQ(0, lua.stackCount()); std::map<std::string, std::string> map; lua.getKeyValueMap(map, "settings"); ASSERT_EQ(4u, map.size()); ASSERT_NE(map.find("a"), map.end()); ASSERT_NE(map.find("b"), map.end()); ASSERT_NE(map.find("c"), map.end()); ASSERT_NE(map.find("d"), map.end()); ASSERT_EQ("false", map["a"]); ASSERT_EQ("true", map["b"]); ASSERT_EQ("1", map["c"]); ASSERT_EQ("foo", map["d"]); }
void ConfigManager::getKeyValueMap (LUA& lua, std::map<std::string, std::string>& map, const char *key) { lua.getKeyValueMap(map, key); }