changeset 16332:1f8299e68189

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'.
author Bruno Haible <bruno@clisp.org>
date Mon, 30 Jan 2012 20:32:33 +0100
parents 2f966fea20dc
children 04de064f29e0
files ChangeLog modules/quotearg-tests tests/test-quotearg-simple.c
diffstat 3 files changed, 24 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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
--- a/modules/quotearg-tests
+++ b/modules/quotearg-tests
@@ -18,6 +18,7 @@
 setenv
 unsetenv
 setlocale
+localcharset
 
 configure.ac:
 gt_LOCALE_FR
--- a/tests/test-quotearg-simple.c
+++ b/tests/test-quotearg-simple.c
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "localcharset.h"
 #include "progname.h"
 #include "macros.h"
 
@@ -245,12 +246,20 @@
   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);