Added JsonArray::remove(iterator) and JsonObject::remove(iterator) (issue #479)

This commit is contained in:
Benoit Blanchon
2017-04-12 21:00:13 +02:00
parent 5a16b2117b
commit 8c6f64c111
8 changed files with 130 additions and 63 deletions

View File

@ -29,3 +29,16 @@ TEST_(SizeUntouched_WhenRemoveIsCalledWithAWrongKey) {
EXPECT_EQ(1, _object.size());
}
TEST_(RemoveByIterator) {
DynamicJsonBuffer _jsonBuffer;
JsonObject& _object = _jsonBuffer.parseObject("{\"a\":0,\"b\":1,\"c\":2}");
for (JsonObject::iterator it = _object.begin(); it != _object.end(); ++it) {
if (it->value == 1) _object.remove(it);
}
char result[64];
_object.printTo(result);
EXPECT_STREQ("{\"a\":0,\"c\":2}", result);
}