[libcxx-commits] [libcxx] 2d54bf3 - [libcxx] [test] Fix the monetary locale negative_sign test for en_US.UTF-8 on Windows

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 25 13:48:47 PST 2022


Author: Martin Storsjö
Date: 2022-02-25T23:41:35+02:00
New Revision: 2d54bf3bc75174b85e437eb94bc4d9de311a7e21

URL: https://github.com/llvm/llvm-project/commit/2d54bf3bc75174b85e437eb94bc4d9de311a7e21
DIFF: https://github.com/llvm/llvm-project/commit/2d54bf3bc75174b85e437eb94bc4d9de311a7e21.diff

LOG: [libcxx] [test] Fix the monetary locale negative_sign test for en_US.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

Added: 
    

Modified: 
    libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/negative_sign.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/negative_sign.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/negative_sign.pass.cpp
index 11904d396d6ed..be2f5585d0697 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/negative_sign.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/negative_sign.pass.cpp
@@ -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>
@@ -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
 


        


More information about the libcxx-commits mailing list