✅ add tests to improve coverage
This commit is contained in:
parent
a414e35971
commit
d7b032f565
5 changed files with 14 additions and 10 deletions
|
@ -101,6 +101,9 @@ TEST_CASE("JSON pointers")
|
|||
CHECK(j["/foo/1"_json_pointer] == j["foo"][1]);
|
||||
CHECK(j.contains(json::json_pointer("/foo/0")));
|
||||
CHECK(j.contains(json::json_pointer("/foo/1")));
|
||||
CHECK(not j.contains(json::json_pointer("/foo/3")));
|
||||
CHECK(not j.contains(json::json_pointer("/foo/+")));
|
||||
CHECK(not j.contains(json::json_pointer("/foo/1+2")));
|
||||
CHECK(not j.contains(json::json_pointer("/foo/-")));
|
||||
|
||||
// checked array access
|
||||
|
|
|
@ -464,6 +464,11 @@ TEST_CASE("regression tests")
|
|||
s2 = o["name"];
|
||||
|
||||
CHECK(s2 == "value");
|
||||
|
||||
// improve coverage
|
||||
o["int"] = 1;
|
||||
CHECK_THROWS_AS(s2 = o["int"], json::type_error);
|
||||
CHECK_THROWS_WITH(s2 = o["int"], "[json.exception.type_error.302] type must be string, but is number");
|
||||
}
|
||||
|
||||
SECTION("issue #146 - character following a surrogate pair is skipped")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue