mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-18 13:02:25 +02:00
Test empty nested arrays
This commit is contained in:
@ -11,9 +11,21 @@ size_t IndentedPrintDecorator::write(uint8_t c)
|
|||||||
{
|
{
|
||||||
case '{':
|
case '{':
|
||||||
case '[':
|
case '[':
|
||||||
indent++;
|
|
||||||
|
size_t n;
|
||||||
|
|
||||||
|
if (previousChar == '{' || previousChar == '[')
|
||||||
|
{
|
||||||
|
n = writeln() + sink.write(c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
n = sink.write(c);
|
||||||
|
}
|
||||||
|
|
||||||
previousChar = c;
|
previousChar = c;
|
||||||
return sink.write(c);
|
indent++;
|
||||||
|
return n;
|
||||||
|
|
||||||
case '}':
|
case '}':
|
||||||
case ']':
|
case ']':
|
||||||
|
@ -44,6 +44,16 @@ namespace JsonGeneratorTests
|
|||||||
"]");
|
"]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_METHOD(EmptyNestedArrays)
|
||||||
|
{
|
||||||
|
whenInputIs("[[],[]]");
|
||||||
|
outputMustBe(
|
||||||
|
"[\n"
|
||||||
|
" [],\n"
|
||||||
|
" []\n"
|
||||||
|
"]");
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void whenInputIs(const char input[])
|
void whenInputIs(const char input[])
|
||||||
|
Reference in New Issue
Block a user