mirror of
https://github.com/nlohmann/json.git
synced 2025-07-28 12:02:00 +03:00
🚨 fixed a linter warning
This commit is contained in:
@ -300,7 +300,10 @@ class binary_reader
|
|||||||
|
|
||||||
if (not is_array)
|
if (not is_array)
|
||||||
{
|
{
|
||||||
sax->key(key);
|
if (not sax->key(key))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JSON_UNLIKELY(not parse_bson_element_internal(element_type, element_type_parse_position)))
|
if (JSON_UNLIKELY(not parse_bson_element_internal(element_type, element_type_parse_position)))
|
||||||
|
@ -6635,7 +6635,10 @@ class binary_reader
|
|||||||
|
|
||||||
if (not is_array)
|
if (not is_array)
|
||||||
{
|
{
|
||||||
sax->key(key);
|
if (not sax->key(key))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JSON_UNLIKELY(not parse_bson_element_internal(element_type, element_type_parse_position)))
|
if (JSON_UNLIKELY(not parse_bson_element_internal(element_type, element_type_parse_position)))
|
||||||
|
@ -752,6 +752,28 @@ TEST_CASE("Incomplete BSON Input")
|
|||||||
SaxCountdown scp(0);
|
SaxCountdown scp(0);
|
||||||
CHECK(not json::sax_parse(incomplete_bson, &scp, json::input_format_t::bson));
|
CHECK(not json::sax_parse(incomplete_bson, &scp, json::input_format_t::bson));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("Improve coverage")
|
||||||
|
{
|
||||||
|
SECTION("key")
|
||||||
|
{
|
||||||
|
json j = {{"key", "value"}};
|
||||||
|
auto bson_vec = json::to_bson(j);
|
||||||
|
SaxCountdown scp(2);
|
||||||
|
CHECK(not json::sax_parse(bson_vec, &scp, json::input_format_t::bson));
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("array")
|
||||||
|
{
|
||||||
|
json j =
|
||||||
|
{
|
||||||
|
{ "entry", json::array() }
|
||||||
|
};
|
||||||
|
auto bson_vec = json::to_bson(j);
|
||||||
|
SaxCountdown scp(2);
|
||||||
|
CHECK(not json::sax_parse(bson_vec, &scp, json::input_format_t::bson));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Unsupported BSON input")
|
TEST_CASE("Unsupported BSON input")
|
||||||
|
Reference in New Issue
Block a user