mirror of
https://github.com/nlohmann/json.git
synced 2026-03-06 17:26:24 +00:00
use diagnostic positions in exceptions (#4585)
* add a ci step for Json_Diagnostic_Positions Signed-off-by: Harinath Nampally <harinath922@gmail.com> * Update ci.cmake to address review comments Signed-off-by: Harinath Nampally <harinath922@gmail.com> * address review comment Signed-off-by: Harinath Nampally <harinath922@gmail.com> * fix typo in the comment Signed-off-by: Harinath Nampally <harinath922@gmail.com> * fix typos in ci.cmake Signed-off-by: Harinath Nampally <harinath922@gmail.com> * invoke the new ci step from ubuntu.yml Signed-off-by: Harinath Nampally <harinath922@gmail.com> * issue4561 - use diagnostic positions for exceptions Signed-off-by: Harinath Nampally <harinath922@gmail.com> * fix ci_test_documentation check Signed-off-by: Harinath Nampally <harinath922@gmail.com> * address review comments Signed-off-by: Harinath Nampally <harinath922@gmail.com> * fix ci check failures for unit-diagnostic-postions.cpp Signed-off-by: Harinath Nampally <harinath922@gmail.com> * improvements based on review comments Signed-off-by: Harinath Nampally <harinath922@gmail.com> * fix const correctness string Signed-off-by: Harinath Nampally <harinath922@gmail.com> * further refinements based on reviews Signed-off-by: Harinath Nampally <harinath922@gmail.com> * add one more test case for full coverage Signed-off-by: Harinath Nampally <harinath922@gmail.com> * ci check fix - add const Signed-off-by: Harinath Nampally <harinath922@gmail.com> * add unit tests for json_diagnostic_postions only Signed-off-by: Harinath Nampally <harinath922@gmail.com> * fix ci_test_diagnostics Signed-off-by: Harinath Nampally <harinath922@gmail.com> * fix ci_test_build_documentation check Signed-off-by: Harinath Nampally <harinath922@gmail.com> --------- Signed-off-by: Harinath Nampally <harinath922@gmail.com>
This commit is contained in:
committed by
GitHub
parent
0f9e6ae098
commit
d23291ba26
@@ -1400,14 +1400,24 @@ TEST_CASE("regression tests 1")
|
||||
auto p1 = R"([{"op": "move",
|
||||
"from": "/one/two/three",
|
||||
"path": "/a/b/c"}])"_json;
|
||||
#if JSON_DIAGNOSTIC_POSITIONS
|
||||
CHECK_THROWS_WITH_AS(model.patch(p1),
|
||||
"[json.exception.out_of_range.403] (bytes 0-158) key 'a' not found", json::out_of_range&);
|
||||
#else
|
||||
CHECK_THROWS_WITH_AS(model.patch(p1),
|
||||
"[json.exception.out_of_range.403] key 'a' not found", json::out_of_range&);
|
||||
#endif
|
||||
|
||||
auto p2 = R"([{"op": "copy",
|
||||
"from": "/one/two/three",
|
||||
"path": "/a/b/c"}])"_json;
|
||||
#if JSON_DIAGNOSTIC_POSITIONS
|
||||
CHECK_THROWS_WITH_AS(model.patch(p2),
|
||||
"[json.exception.out_of_range.403] (bytes 0-158) key 'a' not found", json::out_of_range&);
|
||||
#else
|
||||
CHECK_THROWS_WITH_AS(model.patch(p2),
|
||||
"[json.exception.out_of_range.403] key 'a' not found", json::out_of_range&);
|
||||
#endif
|
||||
}
|
||||
|
||||
SECTION("issue #961 - incorrect parsing of indefinite length CBOR strings")
|
||||
|
||||
Reference in New Issue
Block a user