[llvm] 9fec674 - Encode columnWidthUTF8 tests as UTF-8 sequences.

Corentin Jabot via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 06:56:39 PST 2022


Author: Corentin Jabot
Date: 2022-11-28T15:56:12+01:00
New Revision: 9fec67483d4c64ff8c8ec1db155370bec35af09b

URL: https://github.com/llvm/llvm-project/commit/9fec67483d4c64ff8c8ec1db155370bec35af09b
DIFF: https://github.com/llvm/llvm-project/commit/9fec67483d4c64ff8c8ec1db155370bec35af09b.diff

LOG: Encode columnWidthUTF8 tests as UTF-8 sequences.

Some platforms do not encode string literals as UTF-8
when building llvm

Added: 
    

Modified: 
    llvm/unittests/Support/UnicodeTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Support/UnicodeTest.cpp b/llvm/unittests/Support/UnicodeTest.cpp
index 1e31dbfd4bbf..a2c88170332a 100644
--- a/llvm/unittests/Support/UnicodeTest.cpp
+++ b/llvm/unittests/Support/UnicodeTest.cpp
@@ -45,10 +45,10 @@ TEST(Unicode, columnWidthUTF8) {
   EXPECT_EQ(3, columnWidthUTF8("q\344\270\200"));
   EXPECT_EQ(3, columnWidthUTF8("\314\200\340\270\201\344\270\200"));
 
-  EXPECT_EQ(2, columnWidthUTF8("\u231A")); // WATCH (emoji)
-  EXPECT_EQ(2, columnWidthUTF8("\U0001FADB")); // PEA POD (Unicode 15 emoji)
-  EXPECT_EQ(2, columnWidthUTF8("\U0001B132")); // HIRAGANA LETTER SMALL KO
-  EXPECT_EQ(2, columnWidthUTF8("\U00017042")); // TANGUT IDEOGRAPH
+  EXPECT_EQ(2, columnWidthUTF8("\342\214\232")); // U+231A WATCH (emoji)
+  EXPECT_EQ(2, columnWidthUTF8("\360\237\253\233")); // U+1FADB PEA POD (Unicode 15 emoji)
+  EXPECT_EQ(2, columnWidthUTF8("\360\233\204\262")); // U+1B132 HIRAGANA LETTER SMALL KO
+  EXPECT_EQ(2, columnWidthUTF8("\360\227\201\202")); // U+17042 TANGUT IDEOGRAPH
 
   // Invalid UTF-8 strings, columnWidthUTF8 should error out.
   EXPECT_EQ(-2, columnWidthUTF8("\344"));


        


More information about the llvm-commits mailing list