summaryrefslogtreecommitdiffstats
path: root/llvm/unittests
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2017-12-21 17:14:09 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2017-12-21 17:14:09 +0000
commitb2b961a3dbd1f30b43131676c7dcba340ac0ae08 (patch)
tree5504095300031f005bbc66fec854c684fe1d28d2 /llvm/unittests
parent2e0f7bd0fea7f3b32cd44daa2feeb7325f659a8f (diff)
downloadbcm5719-llvm-b2b961a3dbd1f30b43131676c7dcba340ac0ae08.tar.gz
bcm5719-llvm-b2b961a3dbd1f30b43131676c7dcba340ac0ae08.zip
[YAML] Fix UTF-8 handling
Previous YAML quoting patches broke UTF-8 printing in YAML: see https://reviews.llvm.org/D41290#961801. Differential Revision: https://reviews.llvm.org/D41490 llvm-svn: 321283
Diffstat (limited to 'llvm/unittests')
-rw-r--r--llvm/unittests/Support/YAMLIOTest.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/unittests/Support/YAMLIOTest.cpp b/llvm/unittests/Support/YAMLIOTest.cpp
index 9caff85a596..650b02cdea9 100644
--- a/llvm/unittests/Support/YAMLIOTest.cpp
+++ b/llvm/unittests/Support/YAMLIOTest.cpp
@@ -2541,3 +2541,31 @@ TEST(YAMLIO, TestEscapedSingleQuoteInsideSingleQuote) {
ostr.flush();
EXPECT_EQ("'abc''fdf'", out);
}
+
+TEST(YAMLIO, TestEscapedUTF8SingleQuoteInsideDoubleQuote) {
+ std::string Id = "parameter 'параметр' is unused";
+
+ std::string out;
+ llvm::raw_string_ostream ostr(out);
+ Output xout(ostr, nullptr, 0);
+
+ llvm::yaml::EmptyContext Ctx;
+ yamlize(xout, Id, true, Ctx);
+
+ ostr.flush();
+ EXPECT_EQ("\"parameter 'параметр' is unused\"", out);
+}
+
+TEST(YAMLIO, TestEscapedUTF8) {
+ std::string Id = "/*параметр*/";
+
+ std::string out;
+ llvm::raw_string_ostream ostr(out);
+ Output xout(ostr, nullptr, 0);
+
+ llvm::yaml::EmptyContext Ctx;
+ yamlize(xout, Id, true, Ctx);
+
+ ostr.flush();
+ EXPECT_EQ("\"/*параметр*/\"", out);
+}
OpenPOWER on IntegriCloud