From aafabd8e8d6971853603c977c392932d9555e029 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Mon, 25 Aug 2014 10:22:42 +0200 Subject: [PATCH] Test an object with two memebrs --- JsonGenerator/IndentedPrintDecorator.cpp | 3 +++ JsonGeneratorTests/IntentedPrintTests.cpp | 10 ++++++++++ 2 files changed, 13 insertions(+) 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[])