]> Savannah Git Hosting - gnulib.git/commitdiff
mcel tests: Run the test in several locales.
authorBruno Haible <bruno@clisp.org>
Tue, 21 May 2024 19:20:15 +0000 (21:20 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 21 May 2024 19:20:15 +0000 (21:20 +0200)
* tests/test-mcel-1.sh: New file, based on tests/test-mbrtowc-1.sh.
* tests/test-mcel-2.sh: New file, based on tests/test-mbrtowc-2.sh.
* tests/test-mcel-3.sh: New file, based on tests/test-mbrtowc-3.sh.
* tests/test-mcel-4.sh: New file, based on tests/test-mbrtowc-4.sh.
* tests/test-mcel-5.sh: New file, based on tests/test-mbrtowc-5.sh.
* modules/mcel-tests (Files): Add them. Add tests/macros.h,
m4/locale-fr.m4, m4/locale-ja.m4, m4/locale-zh.m4, m4/codeset.m4.
(Depends-on): Remove assert-h.
(configure.ac, Makefile.am): Essentially copy from
modules/mbrtowc-tests.

ChangeLog
modules/mcel-tests
tests/test-mcel-1.sh [new file with mode: 0755]
tests/test-mcel-2.sh [new file with mode: 0755]
tests/test-mcel-3.sh [new file with mode: 0755]
tests/test-mcel-4.sh [new file with mode: 0755]
tests/test-mcel-5.sh [new file with mode: 0755]

index 2935af0691e7fb62ee6e86169ef81c9f36f1fe66..1dd38d2fb4bc991918c67d8415a8d6a2d16b6594 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-05-21  Bruno Haible  <bruno@clisp.org>
+
+       mcel tests: Run the test in several locales.
+       * tests/test-mcel-1.sh: New file, based on tests/test-mbrtowc-1.sh.
+       * tests/test-mcel-2.sh: New file, based on tests/test-mbrtowc-2.sh.
+       * tests/test-mcel-3.sh: New file, based on tests/test-mbrtowc-3.sh.
+       * tests/test-mcel-4.sh: New file, based on tests/test-mbrtowc-4.sh.
+       * tests/test-mcel-5.sh: New file, based on tests/test-mbrtowc-5.sh.
+       * modules/mcel-tests (Files): Add them. Add tests/macros.h,
+       m4/locale-fr.m4, m4/locale-ja.m4, m4/locale-zh.m4, m4/codeset.m4.
+       (Depends-on): Remove assert-h.
+       (configure.ac, Makefile.am): Essentially copy from
+       modules/mbrtowc-tests.
+
 2024-05-21  Bruno Haible  <bruno@clisp.org>
 
        flock tests: Mark as expected failure on Solaris 11.
index d157608ce3127bc32aa9e99417c405dd1b1231f4..cc993657d975cf6e9b3737b0179e707c22f7fe30 100644 (file)
@@ -1,13 +1,32 @@
 Files:
+tests/test-mcel-1.sh
+tests/test-mcel-2.sh
+tests/test-mcel-3.sh
+tests/test-mcel-4.sh
+tests/test-mcel-5.sh
 tests/test-mcel.c
+tests/macros.h
+m4/locale-fr.m4
+m4/locale-ja.m4
+m4/locale-zh.m4
+m4/codeset.m4
 
 Depends-on:
-assert-h
 setlocale
 
 configure.ac:
+gt_LOCALE_FR
+gt_LOCALE_FR_UTF8
+gt_LOCALE_JA
+gt_LOCALE_ZH_CN
 
 Makefile.am:
-TESTS += test-mcel
+TESTS += \
+  test-mcel-1.sh test-mcel-2.sh test-mcel-3.sh test-mcel-4.sh test-mcel-5.sh
+TESTS_ENVIRONMENT += \
+  LOCALE_FR='@LOCALE_FR@' \
+  LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
+  LOCALE_JA='@LOCALE_JA@' \
+  LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-mcel
 test_mcel_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
diff --git a/tests/test-mcel-1.sh b/tests/test-mcel-1.sh
new file mode 100755 (executable)
index 0000000..132824d
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Test whether the POSIX locale has encoding errors.
+LC_ALL=C \
+${CHECKER} ./test-mcel${EXEEXT} 1 || exit 1
+LC_ALL=POSIX \
+${CHECKER} ./test-mcel${EXEEXT} 1 || exit 1
+
+exit 0
diff --git a/tests/test-mcel-2.sh b/tests/test-mcel-2.sh
new file mode 100755 (executable)
index 0000000..fd85e90
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional french locale is installed"
+  else
+    echo "Skipping test: no traditional french locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR \
+${CHECKER} ./test-mcel${EXEEXT} 2
diff --git a/tests/test-mcel-3.sh b/tests/test-mcel-3.sh
new file mode 100755 (executable)
index 0000000..a1f21a7
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no french Unicode locale is installed"
+  else
+    echo "Skipping test: no french Unicode locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR_UTF8 \
+${CHECKER} ./test-mcel${EXEEXT} 3
diff --git a/tests/test-mcel-4.sh b/tests/test-mcel-4.sh
new file mode 100755 (executable)
index 0000000..229bb34
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional japanese locale is installed"
+  else
+    echo "Skipping test: no traditional japanese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_JA \
+${CHECKER} ./test-mcel${EXEEXT} 4
diff --git a/tests/test-mcel-5.sh b/tests/test-mcel-5.sh
new file mode 100755 (executable)
index 0000000..8e42b99
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no transitional chinese locale is installed"
+  else
+    echo "Skipping test: no transitional chinese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_ZH_CN \
+${CHECKER} ./test-mcel${EXEEXT} 5