add testcase

This commit is contained in:
chenguoping 2020-06-11 19:37:40 +08:00
parent 0027908a21
commit 494f0cc5dd

View File

@ -464,6 +464,14 @@ TEST_CASE("element access 2")
CHECK(j_const[json::object_t::key_type("array")] == j["array"]);
}
SECTION("access not-existing value")
{
// not existing access
CHECK_THROWS_AS(j_const["not-existing"], json::out_of_range&);
CHECK_THROWS_WITH(j_const["not-existing"],
"[json.exception.out_of_range.403] key 'not-existing' not found");
}
SECTION("access on non-object type")
{
SECTION("null")