[libcxx] r275772 - Remove locale tests that depend on enviroment variables.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 17 23:15:55 PDT 2016


Author: ericwf
Date: Mon Jul 18 01:15:55 2016
New Revision: 275772

URL: http://llvm.org/viewvc/llvm-project?rev=275772&view=rev
Log:
Remove locale tests that depend on enviroment variables.

Constructing a std::locale object from an empty string selects the language
from the current environment variables. If the environment variables name
a locale that doesn't exist, or isn't installed, then the construction of
facets using that locale may throw.

This patch removes tests that use 'std::locale l("")'.

The optimal solution would be to manually set the environment variables
in the test. Unfortunately there is no portable way to do this.

Modified:
    libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp

Modified: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp?rev=275772&r1=275771&r2=275772&view=diff
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp (original)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp Mon Jul 18 01:15:55 2016
@@ -28,12 +28,10 @@
 #include <cassert>
 
 #include "platform_support.h" // locale name macros
-#include "assert_checkpoint.h"
 
 int main()
 {
     {
-        CHECKPOINT("constructing en-US.UTF-8");
         std::locale l(LOCALE_en_US_UTF_8);
         {
             assert(std::has_facet<std::ctype_byname<char> >(l));
@@ -47,21 +45,6 @@ int main()
         }
     }
     {
-        CHECKPOINT("constructing default locale");
-        std::locale l("");
-        {
-            assert(std::has_facet<std::ctype_byname<char> >(l));
-            assert(&std::use_facet<std::ctype<char> >(l)
-                == &std::use_facet<std::ctype_byname<char> >(l));
-        }
-        {
-            assert(std::has_facet<std::ctype_byname<wchar_t> >(l));
-            assert(&std::use_facet<std::ctype<wchar_t> >(l)
-                == &std::use_facet<std::ctype_byname<wchar_t> >(l));
-        }
-    }
-    {
-        CHECKPOINT("constructing C locale");
         std::locale l("C");
         {
             assert(std::has_facet<std::ctype_byname<char> >(l));




More information about the cfe-commits mailing list