mirror of
https://github.com/nlohmann/json.git
synced 2026-11-03 19:29:22 +00:00
Expect the byte range of the root in the json_view boolean get<T>() test
With JSON_DIAGNOSTIC_POSITIONS, the type_error.302 message starts with "(bytes 0-4)"; build the expected text with json_view_test::message(), as the other tests of the root value do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N5NasAgbDGG28MqXjQvLqp Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
1 file changed
+3
-3
@@ -1616,9 +1616,9 @@ TEST_CASE("json_view get<T>() of a boolean (#5988)")
|
|||||||
SECTION("the exceptions of the exact number types")
|
SECTION("the exceptions of the exact number types")
|
||||||
{
|
{
|
||||||
const json_document d = json_document::parse("true");
|
const json_document d = json_document::parse("true");
|
||||||
CHECK_THROWS_WITH_AS(d.root().get<json::number_integer_t>(), "[json.exception.type_error.302] type must be number, but is boolean", json::type_error&);
|
CHECK_THROWS_WITH_AS(d.root().get<json::number_integer_t>(), json_view_test::message("type_error.302", "", 0, 4, "type must be number, but is boolean").c_str(), json::type_error&);
|
||||||
CHECK_THROWS_WITH_AS(d.root().get<json::number_unsigned_t>(), "[json.exception.type_error.302] type must be number, but is boolean", json::type_error&);
|
CHECK_THROWS_WITH_AS(d.root().get<json::number_unsigned_t>(), json_view_test::message("type_error.302", "", 0, 4, "type must be number, but is boolean").c_str(), json::type_error&);
|
||||||
CHECK_THROWS_WITH_AS(d.root().get<json::number_float_t>(), "[json.exception.type_error.302] type must be number, but is boolean", json::type_error&);
|
CHECK_THROWS_WITH_AS(d.root().get<json::number_float_t>(), json_view_test::message("type_error.302", "", 0, 4, "type must be number, but is boolean").c_str(), json::type_error&);
|
||||||
CHECK(d.root().get<int>() == 1);
|
CHECK(d.root().get<int>() == 1);
|
||||||
// get_to() and value() go through get<T>()
|
// get_to() and value() go through get<T>()
|
||||||
json::number_float_t x = 0;
|
json::number_float_t x = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user