From 3b28316ee494dce2a6bb3147dafa735affa5f5e1 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 28 Aug 2026 18:48:32 +0000 Subject: [PATCH] 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 --- tests/src/unit-custom-array-type.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/src/unit-custom-array-type.cpp b/tests/src/unit-custom-array-type.cpp index d6d513bba..ddfdd04cb 100644 --- a/tests/src/unit-custom-array-type.cpp +++ b/tests/src/unit-custom-array-type.cpp @@ -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);