[clang-tools-extra] r318791 - [clangd] Add JSON tests with invalid unicode
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 21 10:40:44 PST 2017
Author: sammccall
Date: Tue Nov 21 10:40:43 2017
New Revision: 318791
URL: http://llvm.org/viewvc/llvm-project?rev=318791&view=rev
Log:
[clangd] Add JSON tests with invalid unicode
Modified:
clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp
Modified: clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp?rev=318791&r1=318790&r2=318791&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp Tue Nov 21 10:40:43 2017
@@ -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", {}}});
More information about the cfe-commits
mailing list