mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-18 13:02:25 +02:00
Added a test with a NULL string
This commit is contained in:
@ -25,6 +25,11 @@ void StringBuilder::append(const char* s)
|
|||||||
|
|
||||||
void StringBuilder::appendEscaped(const char* s)
|
void StringBuilder::appendEscaped(const char* s)
|
||||||
{
|
{
|
||||||
|
if (!s)
|
||||||
|
{
|
||||||
|
return append("null");
|
||||||
|
}
|
||||||
|
|
||||||
if (length > capacity - 2)
|
if (length > capacity - 2)
|
||||||
{
|
{
|
||||||
// not enough from for quotes
|
// not enough from for quotes
|
||||||
|
@ -28,6 +28,12 @@ namespace JsonGeneratorTests
|
|||||||
assertResultIs("\"\"");
|
assertResultIs("\"\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_METHOD(Null)
|
||||||
|
{
|
||||||
|
append(NULL);
|
||||||
|
assertResultIs("null");
|
||||||
|
}
|
||||||
|
|
||||||
TEST_METHOD(OneString)
|
TEST_METHOD(OneString)
|
||||||
{
|
{
|
||||||
append("ABCD");
|
append("ABCD");
|
||||||
@ -45,6 +51,9 @@ namespace JsonGeneratorTests
|
|||||||
{
|
{
|
||||||
append("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
append("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||||
assertResultIs("\"ABCDEFGHIJKLMNOPQ\"");
|
assertResultIs("\"ABCDEFGHIJKLMNOPQ\"");
|
||||||
|
|
||||||
|
append("");
|
||||||
|
assertResultIs("\"ABCDEFGHIJKLMNOPQ\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_METHOD(SpecialChars)
|
TEST_METHOD(SpecialChars)
|
||||||
|
Reference in New Issue
Block a user