diff --git a/JsonGenerator/IndentedPrintDecorator.cpp b/JsonGenerator/IndentedPrintDecorator.cpp index 6c386367..55265f39 100644 --- a/JsonGenerator/IndentedPrintDecorator.cpp +++ b/JsonGenerator/IndentedPrintDecorator.cpp @@ -26,6 +26,9 @@ size_t IndentedPrintDecorator::write(uint8_t c) return writeln() + sink.write(c); } + case ',': + return sink.write(c) + writeln(); + default: if (emptyBlock) diff --git a/JsonGeneratorTests/IntentedPrintTests.cpp b/JsonGeneratorTests/IntentedPrintTests.cpp index 5839224f..ec0b342e 100644 --- a/JsonGeneratorTests/IntentedPrintTests.cpp +++ b/JsonGeneratorTests/IntentedPrintTests.cpp @@ -46,6 +46,16 @@ namespace JsonGeneratorTests "}"); } + TEST_METHOD(ObjectWithTwoMembers) + { + whenInputIs("{\"key1\":\"value1\",\"key2\":\"value2\"}"); + outputMustBe( + "{\n" + " \"key1\":\"value1\",\n" + " \"key2\":\"value2\"\n" + "}"); + } + private: void whenInputIs(const char input[])