]> Savannah Git Hosting - gnulib.git/commitdiff
duplocale tests: Re-enable the test on platforms without <monetary.h>.
authorBruno Haible <bruno@clisp.org>
Sun, 16 Dec 2018 05:45:51 +0000 (06:45 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 16 Dec 2018 05:50:01 +0000 (06:50 +0100)
* tests/test-duplocale.c: Use more fine-grained #ifs to re-enable most
of the test, on platforms without <monetary.h>.

ChangeLog
tests/test-duplocale.c

index 4ac6b8c0fce67269c609ea3aa420b1934e4ad408..7f52a9ef3e07325124cfbeb909b67edc6c737a32 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-12-16  Bruno Haible  <bruno@clisp.org>
+
+       duplocale tests: Re-enable the test on platforms without <monetary.h>.
+       * tests/test-duplocale.c: Use more fine-grained #ifs to re-enable most
+       of the test, on platforms without <monetary.h>.
+
 2018-12-16  Bruno Haible  <bruno@clisp.org>
 
        localename: Update comments.
index 9946392f0f23058374324c40bef1a05503b08c73..1cf1089c7b7d218bbedf16c5fb48576c9c2a78e0 100644 (file)
 
 #include <locale.h>
 
-#if HAVE_DUPLOCALE && HAVE_MONETARY_H
+#if HAVE_DUPLOCALE
 
 #include "signature.h"
 SIGNATURE_CHECK (duplocale, locale_t, (locale_t));
 
 #include <langinfo.h>
-#include <monetary.h>
+#if HAVE_MONETARY_H
+# include <monetary.h>
+#endif
 #include <stdio.h>
 #include <string.h>
 
@@ -34,7 +36,9 @@ SIGNATURE_CHECK (duplocale, locale_t, (locale_t));
 
 struct locale_dependent_values
 {
+#if HAVE_MONETARY_H
   char monetary[100];
+#endif
   char numeric[100];
   char time[100];
 };
@@ -42,9 +46,11 @@ struct locale_dependent_values
 static void
 get_locale_dependent_values (struct locale_dependent_values *result)
 {
+#if HAVE_MONETARY_H
   strfmon (result->monetary, sizeof (result->monetary),
            "%n", 123.75);
   /* result->monetary is usually "$123.75" */
+#endif
   snprintf (result->numeric, sizeof (result->numeric),
             "%g", 3.5);
   /* result->numeric is usually "3,5" */
@@ -98,7 +104,9 @@ test_with_uselocale (void)
   {
     struct locale_dependent_values results;
     get_locale_dependent_values (&results);
+# if HAVE_MONETARY_H
     ASSERT (strcmp (results.monetary, expected_results.monetary) == 0);
+# endif
     ASSERT (strcmp (results.numeric, expected_results.numeric) == 0);
     ASSERT (strcmp (results.time, expected_results.time) == 0);
   }
@@ -110,7 +118,9 @@ test_with_uselocale (void)
   {
     struct locale_dependent_values results;
     get_locale_dependent_values (&results);
+# if HAVE_MONETARY_H
     ASSERT (strcmp (results.monetary, expected_results.monetary) == 0);
+# endif
     ASSERT (strcmp (results.numeric, expected_results.numeric) == 0);
     ASSERT (strcmp (results.time, expected_results.time) == 0);
   }