added test cases for the last uncovered lines
This commit is contained in:
parent
40312fb07b
commit
6e6dd5f45d
1 changed files with 33 additions and 0 deletions
|
@ -8009,6 +8009,39 @@ TEST_CASE("parser class")
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("special cases")
|
||||
{
|
||||
// the following test cases cover the situation in which an empty
|
||||
// object and array is discarded only after the closing character
|
||||
// has been read
|
||||
|
||||
json j_empty_object = json::parse("{}", [](int, json::parse_event_t e, const json&)
|
||||
{
|
||||
if (e == json::parse_event_t::object_end)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
});
|
||||
CHECK(j_empty_object == json());
|
||||
|
||||
json j_empty_array = json::parse("[]", [](int, json::parse_event_t e, const json&)
|
||||
{
|
||||
if (e == json::parse_event_t::array_end)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
});
|
||||
CHECK(j_empty_array == json());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue