[clangd] Add JSON tests with invalid unicode

llvm-svn: 318791
This commit is contained in:
Sam McCall 2017-11-21 18:40:43 +00:00
parent b92dbb4b0a
commit 40f191f724
1 changed files with 4 additions and 1 deletions

View File

@ -139,7 +139,10 @@ TEST(JSONTest, Parse) {
Compare("\"\x7f\"", "\x7f");
Compare(R"("\ud801\udc37")", "\U00010437"); // UTF16 surrogate pair escape.
Compare("\"\xE2\x82\xAC\xF0\x9D\x84\x9E\"", "\u20ac\U0001d11e"); // UTF8
Compare(R"("\ud801")", "\ufffd"); // Invalid codepoint.
Compare(
R"("LoneLeading=\ud801, LoneTrailing=\udc01, LeadingLeadingTrailing=\ud801\ud801\udc37")",
"LoneLeading=\ufffd, LoneTrailing=\ufffd, "
"LeadingLeadingTrailing=\ufffd\U00010437"); // Invalid unicode.
Compare(R"({"":0,"":0})", obj{{"", 0}});
Compare(R"({"obj":{},"arr":[]})", obj{{"obj", obj{}}, {"arr", {}}});