Parse empty array with leading spaces

This commit is contained in:
Benoit Blanchon committed 2014-10-14 18:01:49 +02:00
1 parent 081b345e7c
commit 81f3460806
2 files changed
+10

No files matched your search

+2
View File
@@ -22,6 +22,8 @@ JsonArray JsonBuffer::parseArray(const char* json)
{
JsonNode* root;
while(*json == ' ') json++;
if (json[0] == '[')
{
root = createNode();
+8
View File
@@ -15,6 +15,14 @@ TEST_F(JsonArray_Parser_Tests, EmptyArray)
EXPECT_EQ(0, array.size());
}
TEST_F(JsonArray_Parser_Tests, EmptyArrayWithLeadingSpaces)
{
JsonArray array = json.parseArray(" []");
EXPECT_TRUE(array.success());
EXPECT_EQ(0, array.size());
}
TEST_F(JsonArray_Parser_Tests, Garbage)
{
JsonArray array = json.parseArray("%*$£¤");