[PATCH] D26979: Do not hard-code locale data in unit tests: get it from the OS instead

Eric van Gyzen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 25 14:23:29 PST 2016

vangyzen added inline comments.

Comment at: projects/libcxx/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp:42
+        assert(std::setlocale(LC_NUMERIC, LOCALE_en_US_UTF_8) != NULL);
+        char *expected = strdup(std::localeconv()->grouping);
+        assert(std::setlocale(LC_NUMERIC, "C") != NULL);
localeconv()->grouping can become invalid after we reset the locale to "C", so duplicate the string into a local.

Comment at: projects/libcxx/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp:79
             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
-            assert(np.thousands_sep() == L',');
+            assert(np.thousands_sep() == wexpected);
This assertion now fails for me.  wexpected is 0xa0 (NBSP), which is correct.  However, np.thousands_sep() is -62, which is 0xc2, which is the first byte of a UTF-8-encoded NBSP.  It looks like the library isn't correctly handling multibyte thousands separators.


More information about the cfe-commits mailing list