From 40f191f724d2fcf3f69efa71093e7a029cbf7476 Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Tue, 21 Nov 2017 18:40:43 +0000 Subject: [PATCH] [clangd] Add JSON tests with invalid unicode llvm-svn: 318791 --- clang-tools-extra/unittests/clangd/JSONExprTests.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clang-tools-extra/unittests/clangd/JSONExprTests.cpp b/clang-tools-extra/unittests/clangd/JSONExprTests.cpp index 25f4384..25be3fb 100644 --- a/clang-tools-extra/unittests/clangd/JSONExprTests.cpp +++ b/clang-tools-extra/unittests/clangd/JSONExprTests.cpp @@ -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", {}}}); -- 2.7.4