Convenient methods for JSON integer. (#5089)

* Fix parsing empty object.
This commit is contained in:
Jiaming Yuan
2019-12-05 11:01:12 +08:00
committed by GitHub
parent dcde433402
commit f0ca53d9ec
3 changed files with 24 additions and 6 deletions

View File

@@ -226,6 +226,10 @@ TEST(Json, EmptyObject) {
std::stringstream iss(str);
auto json = Json::Load(StringView{str.c_str(), str.size()});
ASSERT_TRUE(IsA<Object>(json["statistic"]));
str = R"json({"Config": {},"Model": {}})json"; // NOLINT
json = Json::Load(StringView{str.c_str(), str.size()});
ASSERT_TRUE(IsA<Object>(json["Model"]));
}
TEST(Json, EmptyArray) {