static_members.cc (test02): Less provincial.
authorBenjamin Kosnik <bkoz@redhat.com>
Tue, 15 Oct 2002 01:05:30 +0000 (01:05 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Tue, 15 Oct 2002 01:05:30 +0000 (01:05 +0000)
2002-10-14  Benjamin Kosnik  <bkoz@redhat.com>

* testsuite/22_locale/static_members.cc (test02): Less provincial.

From-SVN: r58144

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/22_locale/static_members.cc

index 6c2f3f281508fa8ac7bfde62fc8c25bf1836aa1b..b4bf7700ae5651c76156e4e62bba4fc1cfc9a35a 100644 (file)
@@ -1,3 +1,7 @@
+2002-10-14  Benjamin Kosnik  <bkoz@redhat.com>
+
+       * testsuite/22_locale/static_members.cc (test02): Less provincial.
+
 2002-10-14  Benjamin Kosnik  <bkoz@redhat.com>
 
        * testsuite/22_locale/static_members.cc (test02): Disable for 
index 936e8b8e1cf66198bedbdcfcb4502513fa34e7ef..9811dd9a8067dfea65742de8a0b86bc44b3e3eb0 100644 (file)
@@ -67,34 +67,39 @@ void test02()
   using namespace std;
   bool test = true;
   
-  // If the underlying locale doesn't support these names, setlocale
-  // won't be reset. Therefore, disable unless we know named locales work.
-#if _GLIBCPP_C_LOCALE_GNU
-
   const string ph("en_PH");
   const string mx("es_MX");
+  const char* orig = setlocale(LC_ALL, NULL);
+  const char* testph = setlocale(LC_ALL, ph.c_str());
+  const char* testmx = setlocale(LC_ALL, mx.c_str());
+  setlocale(LC_ALL, orig);
 
-  const locale loc_ph(ph.c_str());
-  const locale loc_mx(mx.c_str());
-
-  // Use setlocale between two calls to locale("")
-  const locale loc_env_1("");
-  setlocale(LC_ALL, ph.c_str());
-  const locale loc_env_2("");
-  VERIFY( loc_env_1 == loc_env_2 );
-
-  // Change global locale.
-  locale global_orig = locale::global(loc_mx);
-  const char* lc_all_mx = setlocale(LC_ALL, NULL);
-  if (lc_all_mx)
+  // If the underlying locale doesn't support these names, setlocale
+  // won't be reset. Therefore, disable unless we know these specific
+  // named locales work.
+  if (testph && testmx)
     {
-      cout << "lc_all_mx is " << lc_all_mx << endl;
-      VERIFY( mx == lc_all_mx );
+      const locale loc_ph(ph.c_str());
+      const locale loc_mx(mx.c_str());
+      
+      // Use setlocale between two calls to locale("")
+      const locale loc_env_1("");
+      setlocale(LC_ALL, ph.c_str());
+      const locale loc_env_2("");
+      VERIFY( loc_env_1 == loc_env_2 );
+      
+      // Change global locale.
+      locale global_orig = locale::global(loc_mx);
+      const char* lc_all_mx = setlocale(LC_ALL, NULL);
+      if (lc_all_mx)
+       {
+         cout << "lc_all_mx is " << lc_all_mx << endl;
+         VERIFY( mx == lc_all_mx );
+       }
+      
+      // Restore global settings.
+      locale::global(global_orig);
     }
-
-  // Restore global settings.
-  locale::global(global_orig);
-#endif
 }
 
 // Static counter for use in checking ctors/dtors.