Parse simple strings

This commit is contained in:
Benoit Blanchon
2014-10-15 23:39:25 +02:00
parent 3d92531ad3
commit 241ca79114
3 changed files with 37 additions and 0 deletions

View File

@ -45,6 +45,11 @@ protected:
EXPECT_EQ(expected, static_cast<T>(_array[index]));
}
void elementAtIndexMustBe(int index, const char* expected)
{
EXPECT_STREQ(expected, static_cast<const char*>(_array[index]));
}
StaticJsonBuffer<42> _jsonBuffer;
JsonArray _array;
char _jsonString[256];
@ -147,4 +152,14 @@ TEST_F(JsonArray_Parser_Tests, TwoNulls)
sizeMustBe(2);
firstElementMustBe(nullCharPtr);
secondElementMustBe(nullCharPtr);
}
TEST_F(JsonArray_Parser_Tests, TwoStrings)
{
whenInputIs("[\"hello\",\"world\"]");
parseMustSucceed();
sizeMustBe(2);
firstElementMustBe("hello");
secondElementMustBe("world");
}