mirror of
https://github.com/nlohmann/json.git
synced 2026-08-29 20:47:14 +00:00
Do not parse the value in the array-at() test
JSON_DIAGNOSTIC_POSITIONS adds the byte range of the value to the exception message, which a parsed value has and an in-memory one does not, so the two message checks failed in that configuration. Build the array in memory instead of parsing it; the test is about at(size_type) not needing array_t::at(), and the byte range is beside the point. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -105,7 +105,9 @@ TEST_CASE("array type without capacity()")
|
||||
|
||||
TEST_CASE("array type without at()")
|
||||
{
|
||||
auto j = no_at_json::parse(R"([1,2,3])");
|
||||
// built in memory rather than parsed, so that the exception message does
|
||||
// not gain a byte range with JSON_DIAGNOSTIC_POSITIONS
|
||||
no_at_json j = {1, 2, 3};
|
||||
const auto& jc = j;
|
||||
|
||||
CHECK(j.at(0) == 1);
|
||||
|
||||
Reference in New Issue
Block a user