From: Bruno Haible Date: Sun, 16 Dec 2018 05:45:51 +0000 (+0100) Subject: duplocale tests: Re-enable the test on platforms without . X-Git-Tag: v1.0~5229 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=5c572752cf36caad097128458e408183569ab29c;p=gnulib.git duplocale tests: Re-enable the test on platforms without . * tests/test-duplocale.c: Use more fine-grained #ifs to re-enable most of the test, on platforms without . --- diff --git a/ChangeLog b/ChangeLog index 4ac6b8c0fc..7f52a9ef3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2018-12-16 Bruno Haible + + duplocale tests: Re-enable the test on platforms without . + * tests/test-duplocale.c: Use more fine-grained #ifs to re-enable most + of the test, on platforms without . + 2018-12-16 Bruno Haible localename: Update comments. diff --git a/tests/test-duplocale.c b/tests/test-duplocale.c index 9946392f0f..1cf1089c7b 100644 --- a/tests/test-duplocale.c +++ b/tests/test-duplocale.c @@ -20,13 +20,15 @@ #include -#if HAVE_DUPLOCALE && HAVE_MONETARY_H +#if HAVE_DUPLOCALE #include "signature.h" SIGNATURE_CHECK (duplocale, locale_t, (locale_t)); #include -#include +#if HAVE_MONETARY_H +# include +#endif #include #include @@ -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); }