Added tests of escaped chars

This commit is contained in:
Benoit Blanchon
2014-09-04 21:30:50 +02:00
parent d4c1b6f2c2
commit 24d173c3b9

View File

@ -33,8 +33,56 @@ namespace ArduinoJsonParserTests
TEST_METHOD(EscapedQuote)
{
whenInputIs("\\\"");
outputMustBe("\"");
whenInputIs("\"12\\\"34\""); // ie 12\"34
outputMustBe("12\"34");
}
TEST_METHOD(EscapedReverseSolidus)
{
whenInputIs("\"12\\\\34\""); // ie 12\\34
outputMustBe("12\\34");
}
TEST_METHOD(EscapedSolidus)
{
whenInputIs("\"12\\/34\"");
outputMustBe("12/34");
}
TEST_METHOD(EscapedBackspace)
{
whenInputIs("\"12\\b34\"");
outputMustBe("12\b34");
}
TEST_METHOD(EscapedFormfeed)
{
whenInputIs("\"12\\f34\"");
outputMustBe("12\f34");
}
TEST_METHOD(EscapedNewline)
{
whenInputIs("\"12\\n34\"");
outputMustBe("12\n34");
}
TEST_METHOD(EscapedCarriageReturn)
{
whenInputIs("\"12\\r34\"");
outputMustBe("12\r34");
}
TEST_METHOD(EscapedTab)
{
whenInputIs("\"12\\t34\"");
outputMustBe("12\t34");
}
TEST_METHOD(AllEscapedCharsTogether)
{
whenInputIs("1\\\"2\\\\3\\/4\\b5\\f6\\n7\\r8\\t9\"");
outputMustBe("1\"2\\3/4\b5\f6\n7\r8\t9");
}
private: