mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Change node_map type from map<ptr,ptr> to vector<pair<ptr,ptr>> (#386)
* Change node_map type from map<ptr,ptr> to vector<pair<ptr,ptr>> Map nodes are now iterated over in document order. * Change insert_map_pair to always append Always append in insert_map_pair even if the key is already present. This breaks the behavior of force_insert which now always inserts KVs even if the key is already present. The first insert for duplicated keys now takes precedence for lookups.
This commit is contained in:
@@ -103,8 +103,8 @@ TEST(NodeTest, MapForceInsert) {
|
||||
|
||||
node.force_insert(k2, v2);
|
||||
EXPECT_EQ("v1", node["k1"].as<std::string>());
|
||||
EXPECT_EQ("v2", node["k2"].as<std::string>());
|
||||
EXPECT_EQ(2, node.size());
|
||||
EXPECT_EQ("v1", node["k2"].as<std::string>());
|
||||
EXPECT_EQ(3, node.size());
|
||||
}
|
||||
|
||||
TEST(NodeTest, UndefinedConstNodeWithFallback) {
|
||||
|
Reference in New Issue
Block a user