fix #60 (double escaping)
This commit is contained in:
parent
28f21c43f4
commit
fc58a73523
4 changed files with 30 additions and 19 deletions
|
|
@ -7328,12 +7328,12 @@ TEST_CASE("parser class")
|
|||
|
||||
SECTION("escaped")
|
||||
{
|
||||
// quotation mark
|
||||
CHECK(json::parser("\"\\\"\"").parse() == json("\\\""));
|
||||
// reverse solidus
|
||||
CHECK(json::parser("\"\\\\\"").parse() == json("\\\\"));
|
||||
// quotation mark "\""
|
||||
CHECK(json::parser("\"\\\"\"").parse() == R"("\"")"_json);
|
||||
// reverse solidus "\\"
|
||||
CHECK(json::parser("\"\\\\\"").parse() == R"("\\")"_json);
|
||||
// solidus
|
||||
CHECK(json::parser("\"\\/\"").parse() == json("\\/"));
|
||||
CHECK(json::parser("\"\\/\"").parse() == R"("/")"_json);
|
||||
// backspace
|
||||
CHECK(json::parser("\"\\b\"").parse() == json("\b"));
|
||||
// formfeed
|
||||
|
|
@ -8267,3 +8267,16 @@ TEST_CASE("concepts")
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("regression tests")
|
||||
{
|
||||
SECTION("issue #60 - Double quotation mark is not parsed correctly")
|
||||
{
|
||||
SECTION("escape_dobulequote")
|
||||
{
|
||||
auto s = "[\"\\\"foo\\\"\"]";
|
||||
json j = json::parse(s);
|
||||
CHECK(j == R"(["\"foo\""])"_json);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue