File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,16 @@ JSONTEST_FIXTURE(ValueTest, objects) {
204
204
JSONTEST_ASSERT_EQUAL (Json::Value (1234 ), constObject[" id" ]);
205
205
JSONTEST_ASSERT_EQUAL (Json::Value (), constObject[" unknown id" ]);
206
206
207
+ // Access through find()
208
+ const char idKey[] = " id" ;
209
+ const Json::Value* foundId = object1_.find (idKey, idKey + strlen (idKey));
210
+ JSONTEST_ASSERT (foundId != nullptr );
211
+ JSONTEST_ASSERT_EQUAL (Json::Value (1234 ), *foundId);
212
+
213
+ const char unknownIdKey[] = " unknown id" ;
214
+ const Json::Value* foundUnknownId = object1_.find (unknownIdKey, unknownIdKey + strlen (unknownIdKey));
215
+ JSONTEST_ASSERT_EQUAL (nullptr , foundUnknownId);
216
+
207
217
// Access through non-const reference
208
218
JSONTEST_ASSERT_EQUAL (Json::Value (1234 ), object1_[" id" ]);
209
219
JSONTEST_ASSERT_EQUAL (Json::Value (), object1_[" unknown id" ]);
You can’t perform that action at this time.
0 commit comments