[libcxx] r280608 - Fix bad locale test data when using the newest glibc

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 3 17:48:55 PDT 2016


Author: ericwf
Date: Sat Sep  3 19:48:54 2016
New Revision: 280608

URL: http://llvm.org/viewvc/llvm-project?rev=280608&view=rev
Log:
Fix bad locale test data when using the newest glibc

Modified:
    libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
    libcxx/trunk/test/support/test_macros.h

Modified: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp?rev=280608&r1=280607&r2=280608&view=diff
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp (original)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp Sat Sep  3 19:48:54 2016
@@ -24,6 +24,7 @@
 #include <limits>
 #include <cassert>
 
+#include "test_macros.h"
 #include "platform_support.h" // locale name macros
 
 class Fnf
@@ -113,7 +114,14 @@ int main()
 
     {
         Fnf f(LOCALE_ru_RU_UTF_8, 1);
+        // GLIBC <= 2.23 uses currency_symbol="<U0440><U0443><U0431>"
+        // GLIBC >= 2.24 uses currency_symbol="<U20BD>"
+        // See also: http://www.fileformat.info/info/unicode/char/20bd/index.htm
+#if defined(TEST_GLIBC_PREREQ) && TEST_GLIBC_PREREQ(2, 24)
+        assert(f.curr_symbol() == " \xE2\x82\xBD");
+#else
         assert(f.curr_symbol() == " \xD1\x80\xD1\x83\xD0\xB1");
+#endif
     }
     {
         Fnt f(LOCALE_ru_RU_UTF_8, 1);

Modified: libcxx/trunk/test/support/test_macros.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_macros.h?rev=280608&r1=280607&r2=280608&view=diff
==============================================================================
--- libcxx/trunk/test/support/test_macros.h (original)
+++ libcxx/trunk/test/support/test_macros.h Sat Sep  3 19:48:54 2016
@@ -62,6 +62,13 @@
 #endif
 #endif
 
+// Attempt to deduce GCC version
+#if defined(_LIBCPP_VERSION) && __has_include(<features.h>)
+#include <features.h>
+#define TEST_HAS_GLIBC
+#define TEST_GLIBC_PREREQ(major, minor) __GLIBC_PREREQ(major, minor)
+#endif
+
 /* Features that were introduced in C++14 */
 #if TEST_STD_VER >= 14
 #define TEST_HAS_EXTENDED_CONSTEXPR




More information about the cfe-commits mailing list