fixed bug that INI group might already been destroyed while iterating the group

This commit is contained in:
Zero Fanker 2024-05-19 11:37:40 -04:00
parent f1b969219a
commit 48c9065537
2 changed files with 15 additions and 4 deletions

View file

@ -29,12 +29,18 @@ TEST(IniFileGroup, ValidIniWithValidContentTest) {
auto const bldTypes = group.GetSection("BuildingTypes");
auto idx = 0;
//for (auto const& [key, val] : bldTypes) {
for (auto it = bldTypes.begin(); it != bldTypes.end(); ++it) {
auto const& [key, val] = *it;
EXPECT_EQ(val, referenceList[idx++]);
}
// This is to test RHS issue
idx = 0;
for (auto const& [key, val] : group.GetSection("BuildingTypes")) {
EXPECT_EQ(val, referenceList[idx++]);
}
EXPECT_EQ(group.GetString("GACNST", "Strength"), "2000");
}
#endif