Skip to content

Commit

Permalink
[libcxx] [test] Fix the monetary locale negative_sign test for en_US.…
Browse files Browse the repository at this point in the history
…UTF-8 on Windows

On Windows, the en_US.UTF-8 locale returns `n_sign_posn == 0`, which
means that the sign for a negative currency is parentheses around
the whole value, instead of a leading minus.

Differential Revision: https://reviews.llvm.org/D120549
  • Loading branch information
mstorsjo committed Feb 25, 2022
1 parent 2ce6bc6 commit 2d54bf3
Showing 1 changed file with 16 additions and 2 deletions.
Expand Up @@ -11,8 +11,6 @@
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8

// XFAIL: LIBCXX-WINDOWS-FIXME

// <locale>

// class moneypunct_byname<charT, International>
Expand Down Expand Up @@ -83,20 +81,36 @@ int main(int, char**)

{
Fnf f(LOCALE_en_US_UTF_8, 1);
#if defined(_WIN32)
assert(f.negative_sign() == "()");
#else
assert(f.negative_sign() == "-");
#endif
}
{
Fnt f(LOCALE_en_US_UTF_8, 1);
#if defined(_WIN32)
assert(f.negative_sign() == "()");
#else
assert(f.negative_sign() == "-");
#endif
}
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
Fwf f(LOCALE_en_US_UTF_8, 1);
#if defined(_WIN32)
assert(f.negative_sign() == L"()");
#else
assert(f.negative_sign() == L"-");
#endif
}
{
Fwt f(LOCALE_en_US_UTF_8, 1);
#if defined(_WIN32)
assert(f.negative_sign() == L"()");
#else
assert(f.negative_sign() == L"-");
#endif
}
#endif

Expand Down

0 comments on commit 2d54bf3

Please sign in to comment.