mirror of
https://github.com/nlohmann/json.git
synced 2026-09-30 14:05:18 +00:00
Mark the code of json_view that tests cannot reach
The 4 GiB limit and the fallback for an input that parse() accepts but the view rejects (a bug) are excluded from the coverage; shrink_to_fit() of an empty document is tested. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -351,6 +351,11 @@ TEST_CASE("json_view")
|
||||
CHECK(reused.memory_usage() < grown);
|
||||
CHECK(reused.root().materialize() == json::parse(smaller));
|
||||
|
||||
// an empty document has nothing to release
|
||||
json_document empty;
|
||||
empty.shrink_to_fit();
|
||||
CHECK(empty.memory_usage() == 0);
|
||||
|
||||
// a small document stays in the storage block of the header
|
||||
json_document small = json_document::parse("[1,[2,3],{\"a\":\"b\\n\"}]"); // NOLINT(modernize-raw-string-literal)
|
||||
small.shrink_to_fit();
|
||||
|
||||
Reference in New Issue
Block a user