diff options
author | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2017-12-21 17:14:09 +0000 |
---|---|---|
committer | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2017-12-21 17:14:09 +0000 |
commit | dd3d1e98e0e74721a0ae9493a41fbe3ec2dfbb20 (patch) | |
tree | 885cbbe0839889b7d3fd44f79c8d2dfa48adf374 /unittests | |
parent | 5de0a989c69033332c278b178cd678d6ed2828ec (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321283 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Support/YAMLIOTest.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/unittests/Support/YAMLIOTest.cpp b/unittests/Support/YAMLIOTest.cpp index 9caff85a596..650b02cdea9 100644 --- a/unittests/Support/YAMLIOTest.cpp +++ b/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); +} |