Improved coverage of JsonDeserializer

This commit is contained in:
Benoit Blanchon
2020-02-17 09:15:34 +01:00
parent 85499be855
commit 1902c0ec93
6 changed files with 234 additions and 22 deletions

View File

@ -31,6 +31,38 @@ TEST_CASE("serializeJson(JsonVariant)") {
SECTION("string") {
check(std::string("hello"), "\"hello\"");
SECTION("Escape quotation mark") {
check(std::string("hello \"world\""), "\"hello \\\"world\\\"\"");
}
SECTION("Escape reverse solidus") {
check(std::string("hello\\world"), "\"hello\\\\world\"");
}
SECTION("Don't escape solidus") {
check(std::string("fifty/fifty"), "\"fifty/fifty\"");
}
SECTION("Escape backspace") {
check(std::string("hello\bworld"), "\"hello\\bworld\"");
}
SECTION("Escape formfeed") {
check(std::string("hello\fworld"), "\"hello\\fworld\"");
}
SECTION("Escape linefeed") {
check(std::string("hello\nworld"), "\"hello\\nworld\"");
}
SECTION("Escape carriage return") {
check(std::string("hello\rworld"), "\"hello\\rworld\"");
}
SECTION("Escape tab") {
check(std::string("hello\tworld"), "\"hello\\tworld\"");
}
}
SECTION("SerializedValue<const char*>") {