OSDN Git Service

* testsuite/testsuite_hooks.h (run_tests_wrapped_env): Do not
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / testsuite / testsuite_hooks.cc
index 3527779..f9e7418 100644 (file)
@@ -148,9 +148,19 @@ namespace __gnu_cxx_test
     bool test = true;
     
     // Set the global locale. 
-    locale loc_name(name);
-    locale orig = locale::global(loc_name);
-    
+    try
+      {
+       locale loc_name(name);
+       locale orig = locale::global(loc_name);
+      }
+    catch (std::runtime_error& ex)
+      {
+       if (std::strstr (ex.what(), "unhandled name in generic implementation"))
+         return;
+       else
+         throw;
+      }
+
     const char* res = setlocale(LC_ALL, name);
     if (res != NULL)
       {
@@ -173,9 +183,18 @@ namespace __gnu_cxx_test
     
 #ifdef _GLIBCPP_HAVE_SETENV 
     // Set the global locale. 
-    locale loc_name(name);
-    locale orig = locale::global(loc_name);
-
+    try
+      {
+       locale loc_name(name);
+       locale orig = locale::global(loc_name);
+      }
+    catch (std::runtime_error& ex)
+      {
+       if (std::strstr (ex.what(), "unhandled name in generic implementation"))
+         return;
+       else
+         throw;
+      }
     // Set environment variable env to value in name. 
     const char* oldENV = getenv(env);
     if (!setenv(env, name, 1))
@@ -186,11 +205,25 @@ namespace __gnu_cxx_test
       }
     else
       throw environment_variable(string(env) + string(" to ") + string(name));
-#else
-    throw not_found("setenv");
 #endif
   }
 
+  void 
+  run_test_wrapped_generic_locale_exception_catcher(const test_func f)
+  {
+    try
+      {
+       f();
+      }
+    catch (std::runtime_error& ex)
+      {
+       if (std::strstr (ex.what(), "unhandled name in generic implementation"))
+         return;
+       else
+         throw;
+      }
+  }
+
   counter::size_type  counter::count = 0;
   unsigned int copy_constructor::count_ = 0;
   unsigned int copy_constructor::throw_on_ = 0;