mirror of
https://github.com/nlohmann/json.git
synced 2026-09-29 19:20:30 +00:00
Account for JSON_DIAGNOSTIC_POSITIONS in the ordered_json parent-pointer test
The merge_patch() case parses its input, so with JSON_DIAGNOSTIC_POSITIONS the exception message also carries the byte range of the parsed value. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -430,7 +430,11 @@ TEST_CASE("Regression tests for extended diagnostics")
|
||||
CHECK(j.dump() == R"({"a":{"c":{"c":"s"},"e":"s"}})");
|
||||
|
||||
auto const& constJ = j;
|
||||
#if JSON_DIAGNOSTIC_POSITIONS
|
||||
CHECK_THROWS_WITH_AS(constJ["a"]["c"]["c"].at(0), "[json.exception.type_error.304] (/a/c/c) (bytes 18-21) cannot use at() with string", ordered_json::type_error);
|
||||
#else
|
||||
CHECK_THROWS_WITH_AS(constJ["a"]["c"]["c"].at(0), "[json.exception.type_error.304] (/a/c/c) cannot use at() with string", ordered_json::type_error);
|
||||
#endif
|
||||
ordered_json const copy = j;
|
||||
CHECK(copy == j);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user