Skip to content

Commit 6efda5e

Browse files
committed
[libcxx] [test] Fix the locale ctype widen tests on Windows
On Windows, like on macOS and FreeBSD, widening char(-5) in the "C" locale succeeds and produces L'\u00fb'. Switch widen_many to test \xfb instead of \x85; the mingw version of btowc widens \x85 in the "C" locale into \u2026 (which is the corresponding character according to the Windows-1252 codepage), while Microsoft CRT's btowc widens it into \u0085 (just like macOS and FreeBSD). Switch this to test \xfb which is the character tested by the widen_1 test (as `char(-5)`), which gets handled the same by all Windows implementations of btowc. Differential Revision: https://reviews.llvm.org/D121003
1 parent 357afd9 commit 6efda5e

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
// REQUIRES: locale.en_US.UTF-8
10-
// XFAIL: LIBCXX-WINDOWS-FIXME
1110
// XFAIL: LIBCXX-AIX-FIXME
1211
// XFAIL: libcpp-has-no-wide-characters
1312

@@ -58,7 +57,7 @@ int main(int, char**)
5857
assert(f.widen('.') == L'.');
5958
assert(f.widen('a') == L'a');
6059
assert(f.widen('1') == L'1');
61-
#if defined(__APPLE__) || defined(__FreeBSD__)
60+
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32)
6261
assert(f.widen(char(-5)) == L'\u00fb');
6362
#else
6463
assert(f.widen(char(-5)) == wchar_t(-1));

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
// REQUIRES: locale.en_US.UTF-8
10-
// XFAIL: LIBCXX-WINDOWS-FIXME
1110
// XFAIL: LIBCXX-AIX-FIXME
1211
// XFAIL: libcpp-has-no-wide-characters
1312

@@ -35,7 +34,7 @@ int main(int, char**)
3534
typedef std::ctype_byname<wchar_t> F;
3635
std::locale ll(l, new F(LOCALE_en_US_UTF_8));
3736
F const& f = std::use_facet<F>(ll);
38-
std::string in(" A\x07.a1\x85");
37+
std::string in(" A\x07.a1\xfb");
3938
std::vector<wchar_t> v(in.size());
4039

4140
assert(f.widen(&in[0], in.data() + in.size(), v.data()) == in.data() + in.size());
@@ -54,7 +53,7 @@ int main(int, char**)
5453
typedef std::ctype_byname<wchar_t> F;
5554
std::locale ll(l, new F("C"));
5655
const F& f = std::use_facet<F>(ll);
57-
std::string in(" A\x07.a1\x85");
56+
std::string in(" A\x07.a1\xfb");
5857
std::vector<wchar_t> v(in.size());
5958

6059
assert(f.widen(&in[0], in.data() + in.size(), v.data()) == in.data() + in.size());
@@ -64,8 +63,8 @@ int main(int, char**)
6463
assert(v[3] == L'.');
6564
assert(v[4] == L'a');
6665
assert(v[5] == L'1');
67-
#if defined(__APPLE__) || defined(__FreeBSD__)
68-
assert(v[6] == L'\x85');
66+
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32)
67+
assert(v[6] == L'\xfb');
6968
#else
7069
assert(v[6] == wchar_t(-1));
7170
#endif

0 commit comments

Comments
 (0)