fix issue1982: contains() exceptions are incorrectly raised
This commit is contained in:
parent
b7be613b6e
commit
f5a487d1b4
3 changed files with 51 additions and 12 deletions
|
@ -310,12 +310,11 @@ TEST_CASE("JSON pointers")
|
|||
CHECK_THROWS_AS(j_const.at("/01"_json_pointer), json::parse_error&);
|
||||
CHECK_THROWS_WITH(j_const.at("/01"_json_pointer),
|
||||
"[json.exception.parse_error.106] parse error: array index '01' must not begin with '0'");
|
||||
CHECK_THROWS_AS(j.contains("/01"_json_pointer), json::parse_error&);
|
||||
CHECK_THROWS_WITH(j.contains("/01"_json_pointer),
|
||||
"[json.exception.parse_error.106] parse error: array index '01' must not begin with '0'");
|
||||
CHECK_THROWS_AS(j_const.contains("/01"_json_pointer), json::parse_error&);
|
||||
CHECK_THROWS_WITH(j_const.contains("/01"_json_pointer),
|
||||
"[json.exception.parse_error.106] parse error: array index '01' must not begin with '0'");
|
||||
|
||||
CHECK(not j.contains("/01"_json_pointer));
|
||||
CHECK(not j.contains("/01"_json_pointer));
|
||||
CHECK(not j_const.contains("/01"_json_pointer));
|
||||
CHECK(not j_const.contains("/01"_json_pointer));
|
||||
|
||||
// error with incorrect numbers
|
||||
CHECK_THROWS_AS(j["/one"_json_pointer] = 1, json::parse_error&);
|
||||
|
@ -360,12 +359,10 @@ TEST_CASE("JSON pointers")
|
|||
CHECK_THROWS_WITH(j_const.at("/one"_json_pointer) == 1,
|
||||
"[json.exception.parse_error.109] parse error: array index 'one' is not a number");
|
||||
|
||||
CHECK_THROWS_AS(j.contains("/one"_json_pointer), json::parse_error&);
|
||||
CHECK_THROWS_WITH(j.contains("/one"_json_pointer),
|
||||
"[json.exception.parse_error.109] parse error: array index 'one' is not a number");
|
||||
CHECK_THROWS_AS(j_const.contains("/one"_json_pointer), json::parse_error&);
|
||||
CHECK_THROWS_WITH(j_const.contains("/one"_json_pointer),
|
||||
"[json.exception.parse_error.109] parse error: array index 'one' is not a number");
|
||||
CHECK(not j.contains("/one"_json_pointer));
|
||||
CHECK(not j.contains("/one"_json_pointer));
|
||||
CHECK(not j_const.contains("/one"_json_pointer));
|
||||
CHECK(not j_const.contains("/one"_json_pointer));
|
||||
|
||||
CHECK_THROWS_AS(json({{"/list/0", 1}, {"/list/1", 2}, {"/list/three", 3}}).unflatten(), json::parse_error&);
|
||||
CHECK_THROWS_WITH(json({{"/list/0", 1}, {"/list/1", 2}, {"/list/three", 3}}).unflatten(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue