Added JsonObject::containsKey()

This commit is contained in:
Benoit Blanchon committed 2014-11-07 17:27:30 +01:00
1 parent b4b475d692
commit d38131d495
3 files changed
+18 -1

No files matched your search

+14
View File
@@ -114,3 +114,17 @@ TEST_F(JsonObject_Container_Tests, CanStoreInnerObjects) {
EXPECT_EQ(&innerObject1, &object["hello"].asObject());
EXPECT_EQ(&innerObject2, &object["world"].asObject());
}
TEST_F(JsonObject_Container_Tests, ContainsKeyReturnFalseForNonExistingKey) {
EXPECT_FALSE(object.containsKey("hello"));
}
TEST_F(JsonObject_Container_Tests, ContainsKeyReturnTrueForDefinedValue) {
object.add("hello", 42);
EXPECT_TRUE(object.containsKey("hello"));
}
TEST_F(JsonObject_Container_Tests, ContainsKeyReturnFalseForUndefinedValue) {
object.add("hello");
EXPECT_FALSE(object.containsKey("hello"));
}