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