From c59ad952522b4509c45056ee376f0958361aeef5 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 11 Oct 2026 10:27:16 +0200 Subject: [PATCH] Expect type_error.321 for deep discarded values in the BON8 writer test (#5807) #5806 added the test while #5802 made to_bon8 reject discarded values; both merged, so the test failed on develop. Signed-off-by: Niels Lohmann --- tests/src/unit-large_json.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/src/unit-large_json.cpp b/tests/src/unit-large_json.cpp index 34cf2a166..ecd6f9f81 100644 --- a/tests/src/unit-large_json.cpp +++ b/tests/src/unit-large_json.cpp @@ -539,9 +539,9 @@ TEST_CASE("issue #5392 - binary writers on deeply nested values") { const std::size_t depth = nlohmann::detail::recursion_depth_limit() + 50; - // BON8 writes nothing for a discarded value, deep or not + // BON8 rejects a discarded value (type_error.321), deep or not const json deep_discarded = nested_array(depth, json(json::value_t::discarded)); - CHECK(json::to_bon8(deep_discarded) == std::vector(depth, 0x81)); + CHECK_THROWS_AS(json::to_bon8(deep_discarded), json::type_error); // errors are thrown from below the bound as from above it const json deep_invalid_string = nested_array(depth, json(std::string("\x80")));