]> Savannah Git Hosting - gnulib.git/commitdiff
tests: Don't depend on the exact locale name.
authorBruno Haible <bruno@clisp.org>
Sat, 13 Jul 2024 15:26:37 +0000 (17:26 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 13 Jul 2024 15:26:37 +0000 (17:26 +0200)
* tests/test-c-ctype.c: Include <stdlib.h>.
(main): Test the return value of setlocale(). Try not only de_DE, but
also de_DE.ISO-8859-1.
* tests/test-vasnprintf-posix3.c (main): Try not only fa_IR.UTF-8, but
also fa_IR.
* tests/test-vasnwprintf-posix3.c (main): Likewise.

ChangeLog
tests/test-c-ctype.c
tests/test-vasnprintf-posix3.c
tests/test-vasnwprintf-posix3.c

index a4ce2884df81874bef904ba015a83bc8d16cea03..810ef2ae061c464415620cf1ef7e47f9e1200554 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-07-13  Bruno Haible  <bruno@clisp.org>
+
+       tests: Don't depend on the exact locale name.
+       * tests/test-c-ctype.c: Include <stdlib.h>.
+       (main): Test the return value of setlocale(). Try not only de_DE, but
+       also de_DE.ISO-8859-1.
+       * tests/test-vasnprintf-posix3.c (main): Try not only fa_IR.UTF-8, but
+       also fa_IR.
+       * tests/test-vasnwprintf-posix3.c (main): Likewise.
+
 2024-07-10  Pip Cet  <pipcet@protonmail.com>
 
        timespec-sub: Fix compilation error on clang.
index 898e79cc8a3177bb982613d4ba78c23181c1e7f1..7816543a72b8a932598dea488f034be35e475d11 100644 (file)
@@ -23,6 +23,7 @@
 #include <ctype.h>
 #include <limits.h>
 #include <locale.h>
+#include <stdlib.h>
 
 #include "macros.h"
 
@@ -218,11 +219,16 @@ main ()
 
   test_all ();
 
-  setlocale (LC_ALL, "de_DE");
-  test_all ();
+  /* Run the tests in a German unibyte locale.  */
+  if ((setlocale (LC_ALL, "de_DE") != NULL
+       || setlocale (LC_ALL, "de_DE.ISO-8859-1") != NULL)
+      && MB_CUR_MAX == 1)
+    test_all ();
 
-  setlocale (LC_ALL, "ja_JP.EUC-JP");
-  test_all ();
+  /* Run the tests in a traditional Japanese locale.  */
+  if (setlocale (LC_ALL, "ja_JP.EUC-JP") != NULL
+      && MB_CUR_MAX == 2)
+    test_all ();
 
   return test_exit_status;
 }
index 0db514c601f4886d025e51332257b9a0d7a0b6f2..568bfa912e1c945a4d0ff855c47233a10d60adee 100644 (file)
@@ -79,7 +79,8 @@ main (int argc, char *argv[])
 {
 #if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__
   /* Select a locale with Arabic 'outdigits'.  */
-  if (setlocale (LC_ALL, "fa_IR.UTF-8") == NULL)
+  if (setlocale (LC_ALL, "fa_IR.UTF-8") == NULL
+      && setlocale (LC_ALL, "fa_IR") == NULL)
     {
       fprintf (stderr, "Skipping test: no Iranian locale is installed\n");
       return 77;
index f2ddc82660187dd99c728624d3af10545ba403d6..53923bab77bd7af3dee2ac23c44c1e8766ff99f5 100644 (file)
@@ -83,7 +83,8 @@ main (int argc, char *argv[])
 {
 #if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__
   /* Select a locale with Arabic 'outdigits'.  */
-  if (setlocale (LC_ALL, "fa_IR.UTF-8") == NULL)
+  if (setlocale (LC_ALL, "fa_IR.UTF-8") == NULL
+      && setlocale (LC_ALL, "fa_IR") == NULL)
     {
       fprintf (stderr, "Skipping test: no Iranian locale is installed\n");
       return 77;