[libcxx-commits] [PATCH] D134914: [libc++] Remove unique usage of the en_US locale in a test

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 30 05:36:12 PDT 2022


ldionne updated this revision to Diff 464233.
ldionne retitled this revision from "[libc++] Add missing requirement for en_US locale to test" to "[libc++] Remove unique usage of the en_US locale in a test".
ldionne added a comment.

Address comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134914

Files:
  libcxx/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp
  libcxx/test/support/platform_support.h


Index: libcxx/test/support/platform_support.h
===================================================================
--- libcxx/test/support/platform_support.h
+++ libcxx/test/support/platform_support.h
@@ -17,7 +17,6 @@
 #include "test_macros.h"
 
 // locale names
-#define LOCALE_en_US           "en_US"
 #define LOCALE_en_US_UTF_8     "en_US.UTF-8"
 #define LOCALE_fr_FR_UTF_8     "fr_FR.UTF-8"
 #ifdef __linux__
Index: libcxx/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp
===================================================================
--- libcxx/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp
+++ libcxx/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp
@@ -13,6 +13,8 @@
 // explicit codecvt_byname(const char* nm, size_t refs = 0);
 // explicit codecvt_byname(const string& nm, size_t refs = 0);
 
+// REQUIRES: locale.en_US.UTF-8
+
 #include <locale>
 #include <cassert>
 
@@ -40,12 +42,12 @@
 int main(int, char**)
 {
     {
-        std::locale l(std::locale::classic(), new my_facet(LOCALE_en_US));
+        std::locale l(std::locale::classic(), new my_facet(LOCALE_en_US_UTF_8));
         assert(my_facet::count == 1);
     }
     assert(my_facet::count == 0);
     {
-        my_facet f(LOCALE_en_US, 1);
+        my_facet f(LOCALE_en_US_UTF_8, 1);
         assert(my_facet::count == 1);
         {
             std::locale l(std::locale::classic(), &f);
@@ -55,12 +57,12 @@
     }
     assert(my_facet::count == 0);
     {
-        std::locale l(std::locale::classic(), new my_facet(std::string(LOCALE_en_US)));
+        std::locale l(std::locale::classic(), new my_facet(std::string(LOCALE_en_US_UTF_8)));
         assert(my_facet::count == 1);
     }
     assert(my_facet::count == 0);
     {
-        my_facet f(std::string(LOCALE_en_US), 1);
+        my_facet f(std::string(LOCALE_en_US_UTF_8), 1);
         assert(my_facet::count == 1);
         {
             std::locale l(std::locale::classic(), &f);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134914.464233.patch
Type: text/x-patch
Size: 2069 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220930/8748c32c/attachment.bin>


More information about the libcxx-commits mailing list