quotearg: Fix test failure on MacOS X 10.5.
authorBruno Haible <bruno@clisp.org>
Mon, 30 Jan 2012 19:32:33 +0000 (20:32 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 30 Jan 2012 19:34:12 +0000 (20:34 +0100)
* tests/test-quotearg-simple.c: Include localcharset.h.
(main): If the locale encoding is not ASCII, bypass the tests of
locale_quoting_style and clocale_quoting_style.
* modules/quotearg-tests (Depends-on): Add 'localcharset'.

ChangeLog
modules/quotearg-tests
tests/test-quotearg-simple.c

index c6a99f5..27ef884 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-01-29  Bruno Haible  <bruno@clisp.org>
+
+       quotearg: Fix test failure on MacOS X 10.5.
+       * tests/test-quotearg-simple.c: Include localcharset.h.
+       (main): If the locale encoding is not ASCII, bypass the tests of
+       locale_quoting_style and clocale_quoting_style.
+       * modules/quotearg-tests (Depends-on): Add 'localcharset'.
+
 2012-01-29  Jim Meyering  <meyering@redhat.com>
 
        maint.mk: sc_prohibit_canonicalize_without_use: avoid false positive
index 3c37428..1af4eff 100644 (file)
@@ -18,6 +18,7 @@ stdint
 setenv
 unsetenv
 setlocale
+localcharset
 
 configure.ac:
 gt_LOCALE_FR
index 3b3c36b..e21ceb0 100644 (file)
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "localcharset.h"
 #include "progname.h"
 #include "macros.h"
 
@@ -245,12 +246,20 @@ main (int argc _GL_UNUSED, char *argv[])
   for (i = literal_quoting_style; i <= clocale_quoting_style; i++)
     {
       set_quoting_style (NULL, (enum quoting_style) i);
-      compare_strings (use_quotearg_buffer, &results_g[i].group1, ascii_only);
-      compare_strings (use_quotearg, &results_g[i].group2, ascii_only);
-      if (i == c_quoting_style)
-        compare_strings (use_quote_double_quotes, &results_g[i].group2,
-                         ascii_only);
-      compare_strings (use_quotearg_colon, &results_g[i].group3, ascii_only);
+      if (!(i == locale_quoting_style || i == clocale_quoting_style)
+          || (strcmp (locale_charset (), "ASCII") == 0
+              || strcmp (locale_charset (), "ANSI_X3.4-1968") == 0))
+        {
+          compare_strings (use_quotearg_buffer, &results_g[i].group1,
+                           ascii_only);
+          compare_strings (use_quotearg, &results_g[i].group2,
+                           ascii_only);
+          if (i == c_quoting_style)
+            compare_strings (use_quote_double_quotes, &results_g[i].group2,
+                             ascii_only);
+          compare_strings (use_quotearg_colon, &results_g[i].group3,
+                           ascii_only);
+        }
     }
 
   set_quoting_style (NULL, literal_quoting_style);