mirror of
https://github.com/nlohmann/json.git
synced 2026-11-22 02:44:22 +00:00
Fix the BON8 CI failures of the bulk-read tests
- skip the contiguous-versus-stream tests of BON8 strings and BSON keys when exceptions are disabled: they catch the parse errors of invalid input, and without exceptions the library aborts instead - use static_cast for the int64 test value (google-readability-casting) Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
2 files changed
+7
-1
No files matched your search
@@ -222,7 +222,7 @@ TEST_CASE("BON8")
|
|||||||
|
|
||||||
SECTION("signed values are read back as unsigned when not negative")
|
SECTION("signed values are read back as unsigned when not negative")
|
||||||
{
|
{
|
||||||
const json j = json::from_bon8(json::to_bon8(json(std::int64_t(1000))));
|
const json j = json::from_bon8(json::to_bon8(json(static_cast<std::int64_t>(1000))));
|
||||||
CHECK(j.is_number_unsigned());
|
CHECK(j.is_number_unsigned());
|
||||||
CHECK(j == 1000);
|
CHECK(j == 1000);
|
||||||
}
|
}
|
||||||
@@ -645,6 +645,8 @@ TEST_CASE("BON8")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the test catches the exceptions of invalid input
|
||||||
|
#if !defined(JSON_NOEXCEPTION)
|
||||||
TEST_CASE("BON8 strings from contiguous and stream input")
|
TEST_CASE("BON8 strings from contiguous and stream input")
|
||||||
{
|
{
|
||||||
// contiguous input copies the valid UTF-8 of a string in bulk, a stream
|
// contiguous input copies the valid UTF-8 of a string in bulk, a stream
|
||||||
@@ -700,6 +702,7 @@ TEST_CASE("BON8 strings from contiguous and stream input")
|
|||||||
CHECK_THROWS_WITH_AS(_ = json::from_bon8(inputs[7]), "[json.exception.parse_error.110] parse error at byte 23: syntax error while parsing BON8 string: unexpected end of input", json::parse_error&);
|
CHECK_THROWS_WITH_AS(_ = json::from_bon8(inputs[7]), "[json.exception.parse_error.110] parse error at byte 23: syntax error while parsing BON8 string: unexpected end of input", json::parse_error&);
|
||||||
CHECK_THROWS_WITH_AS(_ = json::from_bon8(inputs[9]), "[json.exception.parse_error.110] parse error at byte 22: syntax error while parsing BON8 value: expected end of input; last byte: 0x91", json::parse_error&);
|
CHECK_THROWS_WITH_AS(_ = json::from_bon8(inputs[9]), "[json.exception.parse_error.110] parse error at byte 22: syntax error while parsing BON8 value: expected end of input; last byte: 0x91", json::parse_error&);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// use this testcase outside [hide] to run it with Valgrind
|
// use this testcase outside [hide] to run it with Valgrind
|
||||||
TEST_CASE("BON8 nesting does not consume the call stack")
|
TEST_CASE("BON8 nesting does not consume the call stack")
|
||||||
|
|||||||
@@ -1066,6 +1066,8 @@ TEST_CASE("Incomplete BSON Input")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the test catches the exceptions of invalid input
|
||||||
|
#if !defined(JSON_NOEXCEPTION)
|
||||||
TEST_CASE("BSON keys from contiguous and stream input")
|
TEST_CASE("BSON keys from contiguous and stream input")
|
||||||
{
|
{
|
||||||
// contiguous input reads a key up to its \x00-byte in one step, a stream
|
// contiguous input reads a key up to its \x00-byte in one step, a stream
|
||||||
@@ -1101,6 +1103,7 @@ TEST_CASE("BSON keys from contiguous and stream input")
|
|||||||
CHECK(from_vector == from_stream);
|
CHECK(from_vector == from_stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST_CASE("Negative size of binary value")
|
TEST_CASE("Negative size of binary value")
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user