config_parser: Allow modifying Parser map
This makes it possible to mutate the map owned by the parser. This will
eventually be used for implementing write updates.
Change-Id: I89deb4073a0a3bd59528c6b70fc55b49bc6cd944
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/test_vlan_interface.cpp b/test/test_vlan_interface.cpp
index 728199a..8d31c7b 100644
--- a/test/test_vlan_interface.cpp
+++ b/test/test_vlan_interface.cpp
@@ -103,14 +103,13 @@
filePath /= "test0.50.netdev";
config::Parser parser(filePath);
- EXPECT_EQ(parser.getMap(),
- config::SectionMap(config::SectionMapInt{
- {"NetDev",
- {
- {{"Name", {"test0.50"}}, {"Kind", {"vlan"}}},
- }},
- {"VLAN", {{{"Id", {"50"}}}}},
- }));
+ EXPECT_EQ(parser.map, config::SectionMap(config::SectionMapInt{
+ {"NetDev",
+ {
+ {{"Name", {"test0.50"}}, {"Kind", {"vlan"}}},
+ }},
+ {"VLAN", {{{"Id", {"50"}}}}},
+ }));
}
TEST_F(TestVlanInterface, deleteVLAN)
@@ -131,26 +130,24 @@
fs::path filePath = confDir;
filePath /= "test0.50.netdev";
config::Parser parser(filePath);
- EXPECT_EQ(parser.getMap(),
- config::SectionMap(config::SectionMapInt{
- {"NetDev",
- {
- {{"Name", {"test0.50"}}, {"Kind", {"vlan"}}},
- }},
- {"VLAN", {{{"Id", {"50"}}}}},
- }));
+ EXPECT_EQ(parser.map, config::SectionMap(config::SectionMapInt{
+ {"NetDev",
+ {
+ {{"Name", {"test0.50"}}, {"Kind", {"vlan"}}},
+ }},
+ {"VLAN", {{{"Id", {"50"}}}}},
+ }));
filePath = confDir;
filePath /= "test0.60.netdev";
parser.setFile(filePath);
- EXPECT_EQ(parser.getMap(),
- config::SectionMap(config::SectionMapInt{
- {"NetDev",
- {
- {{"Name", {"test0.60"}}, {"Kind", {"vlan"}}},
- }},
- {"VLAN", {{{"Id", {"60"}}}}},
- }));
+ EXPECT_EQ(parser.map, config::SectionMap(config::SectionMapInt{
+ {"NetDev",
+ {
+ {{"Name", {"test0.60"}}, {"Kind", {"vlan"}}},
+ }},
+ {"VLAN", {{{"Id", {"60"}}}}},
+ }));
deleteVlan("test0.50");
deleteVlan("test0.60");