[libcxx-commits] [PATCH] D122738: [libc++][test] Use the Japanese locale.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 8 11:00:43 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGd49c0ba5abde: [libc++][test] Use the Japanese locale. (authored by Mordante).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122738/new/

https://reviews.llvm.org/D122738

Files:
  libcxx/test/std/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
  libcxx/test/support/platform_support.h
  libcxx/utils/libcxx/test/features.py


Index: libcxx/utils/libcxx/test/features.py
===================================================================
--- libcxx/utils/libcxx/test/features.py
+++ libcxx/utils/libcxx/test/features.py
@@ -193,6 +193,7 @@
 locales = {
   'en_US.UTF-8':     ['en_US.UTF-8', 'en_US.utf8', 'English_United States.1252'],
   'fr_FR.UTF-8':     ['fr_FR.UTF-8', 'fr_FR.utf8', 'French_France.1252'],
+  'ja_JP.UTF-8':     ['ja_JP.UTF-8', 'ja_JP.utf8', 'Japanese_Japan.923'],
   'ru_RU.UTF-8':     ['ru_RU.UTF-8', 'ru_RU.utf8', 'Russian_Russia.1251'],
   'zh_CN.UTF-8':     ['zh_CN.UTF-8', 'zh_CN.utf8', 'Chinese_China.936'],
   'fr_CA.ISO8859-1': ['fr_CA.ISO8859-1', 'French_Canada.1252'],
Index: libcxx/test/support/platform_support.h
===================================================================
--- libcxx/test/support/platform_support.h
+++ libcxx/test/support/platform_support.h
@@ -28,6 +28,7 @@
 #    define LOCALE_fr_CA_ISO8859_1 "fr_CA.ISO8859-1"
 #    define LOCALE_cs_CZ_ISO8859_2 "cs_CZ.ISO8859-2"
 #endif
+#define LOCALE_ja_JP_UTF_8     "ja_JP.UTF-8"
 #define LOCALE_ru_RU_UTF_8     "ru_RU.UTF-8"
 #define LOCALE_zh_CN_UTF_8     "zh_CN.UTF-8"
 
Index: libcxx/test/std/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
===================================================================
--- libcxx/test/std/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
+++ libcxx/test/std/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
@@ -11,6 +11,7 @@
 
 // REQUIRES: locale.en_US.UTF-8
 // REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ja_JP.UTF-8
 
 // <locale>
 
@@ -75,6 +76,18 @@
                (ex == "Today is samedi which is abbreviated 'sam'." )||
                (ex == "Today is samedi which is abbreviated 'sam.'."));
     }
-
+    {
+        const my_facet f(LOCALE_ja_JP_UTF_8, 1);
+        std::string pat("Today is %A which is the %uth day or alternatively %Ou.");
+        cpp17_output_iterator<char*> iter =
+            f.put(cpp17_output_iterator<char*>(str), ios, '*', &t, pat.data(), pat.data() + pat.size());
+        std::string ex(str, base(iter));
+#if defined(_WIN32) ||  defined(__APPLE__)
+		// These platforms have no alternative
+        assert(ex == "Today is \xE5\x9C\x9F\xE6\x9B\x9C\xE6\x97\xA5 which is the 6th day or alternatively 6.");
+#else
+        assert(ex == "Today is \xE5\x9C\x9F\xE6\x9B\x9C\xE6\x97\xA5 which is the 6th day or alternatively \xE5\x85\xAD.");
+#endif
+    }
   return 0;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122738.421590.patch
Type: text/x-patch
Size: 2532 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220408/dcf04f02/attachment-0001.bin>


More information about the libcxx-commits mailing list