forked from bblanchon/ArduinoJson
Renamed EscapedStringTests into EscapedString_PrintTo_Tests
This commit is contained in:
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
using namespace ArduinoJson::Internals;
|
using namespace ArduinoJson::Internals;
|
||||||
|
|
||||||
class EscapedStringTests : public testing::Test
|
class EscapedString_PrintTo_Tests : public testing::Test
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
void whenInputIs(const char* input)
|
void whenInputIs(const char* input)
|
||||||
@ -23,64 +23,63 @@ protected:
|
|||||||
private:
|
private:
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
size_t returnValue;
|
size_t returnValue;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(EscapedStringTests, Null)
|
TEST_F(EscapedString_PrintTo_Tests, Null)
|
||||||
{
|
{
|
||||||
whenInputIs(0);
|
whenInputIs(0);
|
||||||
outputMustBe("null");
|
outputMustBe("null");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(EscapedStringTests, EmptyString)
|
TEST_F(EscapedString_PrintTo_Tests, EmptyString)
|
||||||
{
|
{
|
||||||
whenInputIs("");
|
whenInputIs("");
|
||||||
outputMustBe("\"\"");
|
outputMustBe("\"\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(EscapedStringTests, QuotationMark)
|
TEST_F(EscapedString_PrintTo_Tests, QuotationMark)
|
||||||
{
|
{
|
||||||
whenInputIs("\"");
|
whenInputIs("\"");
|
||||||
outputMustBe("\"\\\"\"");
|
outputMustBe("\"\\\"\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(EscapedStringTests, ReverseSolidus)
|
TEST_F(EscapedString_PrintTo_Tests, ReverseSolidus)
|
||||||
{
|
{
|
||||||
whenInputIs("\\");
|
whenInputIs("\\");
|
||||||
outputMustBe("\"\\\\\"");
|
outputMustBe("\"\\\\\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(EscapedStringTests, Solidus)
|
TEST_F(EscapedString_PrintTo_Tests, Solidus)
|
||||||
{
|
{
|
||||||
whenInputIs("/");
|
whenInputIs("/");
|
||||||
outputMustBe("\"/\""); // but the JSON format allows \/
|
outputMustBe("\"/\""); // but the JSON format allows \/
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(EscapedStringTests, Backspace)
|
TEST_F(EscapedString_PrintTo_Tests, Backspace)
|
||||||
{
|
{
|
||||||
whenInputIs("\b");
|
whenInputIs("\b");
|
||||||
outputMustBe("\"\\b\"");
|
outputMustBe("\"\\b\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(EscapedStringTests, Formfeed)
|
TEST_F(EscapedString_PrintTo_Tests, Formfeed)
|
||||||
{
|
{
|
||||||
whenInputIs("\f");
|
whenInputIs("\f");
|
||||||
outputMustBe("\"\\f\"");
|
outputMustBe("\"\\f\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(EscapedStringTests, Newline)
|
TEST_F(EscapedString_PrintTo_Tests, Newline)
|
||||||
{
|
{
|
||||||
whenInputIs("\n");
|
whenInputIs("\n");
|
||||||
outputMustBe("\"\\n\"");
|
outputMustBe("\"\\n\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(EscapedStringTests, CarriageReturn)
|
TEST_F(EscapedString_PrintTo_Tests, CarriageReturn)
|
||||||
{
|
{
|
||||||
whenInputIs("\r");
|
whenInputIs("\r");
|
||||||
outputMustBe("\"\\r\"");
|
outputMustBe("\"\\r\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(EscapedStringTests, HorizontalTab)
|
TEST_F(EscapedString_PrintTo_Tests, HorizontalTab)
|
||||||
{
|
{
|
||||||
whenInputIs("\t");
|
whenInputIs("\t");
|
||||||
outputMustBe("\"\\t\"");
|
outputMustBe("\"\\t\"");
|
Reference in New Issue
Block a user