diff --git a/JsonGeneratorTests/JsonArray.h b/JsonGeneratorTests/JsonArray.h index 1202edc2..72faf572 100644 --- a/JsonGeneratorTests/JsonArray.h +++ b/JsonGeneratorTests/JsonArray.h @@ -28,8 +28,11 @@ public: for (int i = 0; i < itemCount; i++) { + if (i>0) + append(",", buffer, bufferSize); + append("'", buffer, bufferSize); - append(items[i], buffer, bufferSize); + append(items[i], buffer, bufferSize); append("'", buffer, bufferSize); } diff --git a/JsonGeneratorTests/JsonArrayTests.cpp b/JsonGeneratorTests/JsonArrayTests.cpp index ed7e8ec1..d372021e 100644 --- a/JsonGeneratorTests/JsonArrayTests.cpp +++ b/JsonGeneratorTests/JsonArrayTests.cpp @@ -7,7 +7,7 @@ namespace JsonGeneratorTests { TEST_CLASS(JsonArrayTests) { - JsonArray<32> arr; + JsonArray<3> arr; public: @@ -23,6 +23,14 @@ namespace JsonGeneratorTests AssertJsonIs("['hello']"); } + TEST_METHOD(TwoStrings) + { + arr.add("hello"); + arr.add("world"); + + AssertJsonIs("['hello','world']"); + } + void AssertJsonIs(const char* expected) { char buffer[256];