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_config_parser.cpp b/test/test_config_parser.cpp
index e7d44ef..0dd16af 100644
--- a/test/test_config_parser.cpp
+++ b/test/test_config_parser.cpp
@@ -94,7 +94,7 @@
void ValidateSectionMap()
{
EXPECT_THAT(
- parser.getMap(),
+ parser.map,
testing::ContainerEq(SectionMap(SectionMapInt{
{"Match", {{{"Name", {"eth0"}}}}},
{"Network",
@@ -114,7 +114,7 @@
{
EXPECT_TRUE(parser.getFilename().empty());
EXPECT_EQ(0, parser.getWarnings().size());
- EXPECT_EQ(SectionMap(), parser.getMap());
+ EXPECT_EQ(SectionMap(), parser.map);
}
TEST_F(TestConfigParser, ReadDirectory)
@@ -122,7 +122,7 @@
parser.setFile("/");
EXPECT_EQ("/", parser.getFilename());
EXPECT_EQ(1, parser.getWarnings().size());
- EXPECT_EQ(SectionMap(), parser.getMap());
+ EXPECT_EQ(SectionMap(), parser.map);
}
TEST_F(TestConfigParser, ReadConfigDataMissingFile)
@@ -130,7 +130,7 @@
parser.setFile("/no-such-path");
EXPECT_EQ("/no-such-path", parser.getFilename());
EXPECT_EQ(1, parser.getWarnings().size());
- EXPECT_EQ(SectionMap(), parser.getMap());
+ EXPECT_EQ(SectionMap(), parser.map);
}
TEST_F(TestConfigParser, ReadConfigDataFromFile)
@@ -141,7 +141,7 @@
EXPECT_EQ(4, parser.getWarnings().size());
ValidateSectionMap();
- const auto& map = parser.getMap();
+ const auto& map = parser.map;
EXPECT_EQ("eth0", *map.getLastValueString("Match", "Name"));
EXPECT_EQ("yes", *map.getLastValueString("Network", "DHCP"));