✅ added missing tests found by mutate++
This commit is contained in:
parent
affa3bf4e9
commit
0164b10e10
1 changed files with 26 additions and 0 deletions
|
@ -596,6 +596,32 @@ TEST_CASE("parser class")
|
|||
"missing or wrong low surrogate");
|
||||
}
|
||||
|
||||
SECTION("tests found by mutate++")
|
||||
{
|
||||
// test case to make sure no comma preceeds the first key
|
||||
CHECK_THROWS_AS(json::parser("{,\"key\": false}").parse(), std::invalid_argument);
|
||||
// test case to make sure an object is properly closed
|
||||
CHECK_THROWS_AS(json::parser("[{\"key\": false true]").parse(), std::invalid_argument);
|
||||
|
||||
// test case to make sure the callback is properly evaluated after reading a key
|
||||
{
|
||||
json::parser_callback_t cb = [](int depth, json::parse_event_t event, json & parsed)
|
||||
{
|
||||
if (event == json::parse_event_t::key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
json x = json::parse("{\"key\": false}", cb);
|
||||
CHECK(x == json::object());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("callback function")
|
||||
{
|
||||
auto s_object = R"(
|
||||
|
|
Loading…
Reference in a new issue