[libcxx-commits] [PATCH] D121003: [libcxx] [test] Fix the locale ctype widen tests on Windows

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 5 05:49:54 PDT 2022


mstorsjo updated this revision to Diff 420470.
mstorsjo added a comment.

Rebased, rerunning CI. The CI environment should have been updated to a newer version so that this should pass now.

In the previously failing mingw config, which now is mostly working, another minor difference was uncovered by the switch from old to new style windows testing configs as default (I previously tested it with the old style test configs when testing locally outside of CI).

The mingw implementation of `btowc` differs in how it widens `\x85` compared to Microsoft CRT's implementation of the same function, which hadn't been noticed in test setups with the old test configs.

Therefore, switch widen_many to test using `\xfb` which is the same as the widen_1 test uses (which tests with `char(-5)`), which is unambiguous across the Windows implementations of `btowc`.

@Mordante, can you ack the updated tests, even if the patch itself already was preapproved a couple weeks ago?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121003

Files:
  libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
  libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp


Index: libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
===================================================================
--- libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
+++ libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 // REQUIRES: locale.en_US.UTF-8
-// XFAIL: LIBCXX-WINDOWS-FIXME
 // XFAIL: LIBCXX-AIX-FIXME
 // XFAIL: libcpp-has-no-wide-characters
 
@@ -35,7 +34,7 @@
             typedef std::ctype_byname<wchar_t> F;
             std::locale ll(l, new F(LOCALE_en_US_UTF_8));
             F const& f = std::use_facet<F>(ll);
-            std::string in(" A\x07.a1\x85");
+            std::string in(" A\x07.a1\xfb");
             std::vector<wchar_t> v(in.size());
 
             assert(f.widen(&in[0], in.data() + in.size(), v.data()) == in.data() + in.size());
@@ -54,7 +53,7 @@
             typedef std::ctype_byname<wchar_t> F;
             std::locale ll(l, new F("C"));
             const F& f = std::use_facet<F>(ll);
-            std::string in(" A\x07.a1\x85");
+            std::string in(" A\x07.a1\xfb");
             std::vector<wchar_t> v(in.size());
 
             assert(f.widen(&in[0], in.data() + in.size(), v.data()) == in.data() + in.size());
@@ -64,8 +63,8 @@
             assert(v[3] == L'.');
             assert(v[4] == L'a');
             assert(v[5] == L'1');
-#if defined(__APPLE__) || defined(__FreeBSD__)
-            assert(v[6] == L'\x85');
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32)
+            assert(v[6] == L'\xfb');
 #else
             assert(v[6] == wchar_t(-1));
 #endif
Index: libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
===================================================================
--- libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
+++ libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 // REQUIRES: locale.en_US.UTF-8
-// XFAIL: LIBCXX-WINDOWS-FIXME
 // XFAIL: LIBCXX-AIX-FIXME
 // XFAIL: libcpp-has-no-wide-characters
 
@@ -58,7 +57,7 @@
             assert(f.widen('.') == L'.');
             assert(f.widen('a') == L'a');
             assert(f.widen('1') == L'1');
-#if defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32)
             assert(f.widen(char(-5)) == L'\u00fb');
 #else
             assert(f.widen(char(-5)) == wchar_t(-1));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121003.420470.patch
Type: text/x-patch
Size: 2804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220405/4d361106/attachment.bin>


More information about the libcxx-commits mailing list