Fix parsing empty json object. (#4868)
* Fix parsing empty json object. * Better error message.
This commit is contained in:
@@ -214,6 +214,20 @@ TEST(Json, Null) {
|
||||
ASSERT_TRUE(IsA<Null>(json["key"]));
|
||||
}
|
||||
|
||||
TEST(Json, EmptyObject) {
|
||||
std::string str = R"json(
|
||||
{
|
||||
"rank": 1,
|
||||
"statistic": {
|
||||
|
||||
}
|
||||
}
|
||||
)json";
|
||||
std::stringstream iss(str);
|
||||
auto json = Json::Load(StringView{str.c_str(), str.size()});
|
||||
ASSERT_TRUE(IsA<Object>(json["statistic"]));
|
||||
}
|
||||
|
||||
TEST(Json, EmptyArray) {
|
||||
std::string str = R"json(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user