]> Savannah Git Hosting - gnulib.git/commitdiff
btowc tests: Renumber tests.
authorBruno Haible <bruno@clisp.org>
Sat, 29 Jul 2023 19:39:02 +0000 (21:39 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 29 Jul 2023 19:39:02 +0000 (21:39 +0200)
* tests/test-btowc*.sh: Renamed 1 -> 2 -> 3 -> 1.
* tests/test-btowc.c: Update.
* modules/btowc-tests: Update.

ChangeLog
modules/btowc-tests
tests/test-btowc-1.sh [new file with mode: 0755]
tests/test-btowc-2.sh [new file with mode: 0755]
tests/test-btowc-3.sh [new file with mode: 0755]
tests/test-btowc.c
tests/test-btowc1.sh [deleted file]
tests/test-btowc2.sh [deleted file]
tests/test-btowc3.sh [deleted file]

index 96c217a02eeb87e19f16031dd5363f2ef358c4f7..a46ceef2b123767da15cba63c070fa58b0f2d504 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-07-29  Bruno Haible  <bruno@clisp.org>
+
+       btowc tests: Renumber tests.
+       * tests/test-btowc*.sh: Renamed 1 -> 2 -> 3 -> 1.
+       * tests/test-btowc.c: Update.
+       * modules/btowc-tests: Update.
+
 2023-07-29  Bruno Haible  <bruno@clisp.org>
 
        time-h: Simplify after 2017-05-01 change.
index 59d33eb00bc08c99f7017be6d8262cc0d7dd2295..efb86ce8a102894395524d4ac8630120e7f4eac0 100644 (file)
@@ -1,7 +1,7 @@
 Files:
-tests/test-btowc1.sh
-tests/test-btowc2.sh
-tests/test-btowc3.sh
+tests/test-btowc-1.sh
+tests/test-btowc-2.sh
+tests/test-btowc-3.sh
 tests/test-btowc.c
 tests/signature.h
 tests/macros.h
@@ -16,7 +16,7 @@ gt_LOCALE_FR
 gt_LOCALE_FR_UTF8
 
 Makefile.am:
-TESTS += test-btowc1.sh test-btowc2.sh test-btowc3.sh
+TESTS += test-btowc-1.sh test-btowc-2.sh test-btowc-3.sh
 TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-btowc
 test_btowc_LDADD = $(LDADD) $(SETLOCALE_LIB)
diff --git a/tests/test-btowc-1.sh b/tests/test-btowc-1.sh
new file mode 100755 (executable)
index 0000000..d677656
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Test whether the POSIX locale has encoding errors.
+LC_ALL=C \
+${CHECKER} ./test-btowc${EXEEXT} 1 || exit 1
+LC_ALL=POSIX \
+${CHECKER} ./test-btowc${EXEEXT} 1 || exit 1
+
+exit 0
diff --git a/tests/test-btowc-2.sh b/tests/test-btowc-2.sh
new file mode 100755 (executable)
index 0000000..9f939d6
--- /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-btowc${EXEEXT} 2
diff --git a/tests/test-btowc-3.sh b/tests/test-btowc-3.sh
new file mode 100755 (executable)
index 0000000..4124476
--- /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-btowc${EXEEXT} 3
index 8a803e5335727a9026e3988f1b934f4ce8773f28..908ec6af9ecffd4f3e4a461d1a945782019f589c 100644 (file)
@@ -44,30 +44,14 @@ main (int argc, char *argv[])
      "C" locale.  Furthermore, when you attempt to set the "C" or "POSIX"
      locale via setlocale(), what you get is a "C" locale with UTF-8 encoding,
      that is, effectively the "C.UTF-8" locale.  */
-  if (argc > 1 && strcmp (argv[1], "3") == 0 && MB_CUR_MAX > 1)
-    argv[1] = "2";
+  if (argc > 1 && strcmp (argv[1], "1") == 0 && MB_CUR_MAX > 1)
+    argv[1] = "3";
 #endif
 
   if (argc > 1)
     switch (argv[1][0])
       {
       case '1':
-        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
-        for (c = 0; c < 0x80; c++)
-          ASSERT (btowc (c) == c);
-        for (c = 0xA0; c < 0x100; c++)
-          ASSERT (btowc (c) != WEOF);
-        return 0;
-
-      case '2':
-        /* Locale encoding is UTF-8.  */
-        for (c = 0; c < 0x80; c++)
-          ASSERT (btowc (c) == c);
-        for (c = 0x80; c < 0x100; c++)
-          ASSERT (btowc (c) == WEOF);
-        return 0;
-
-      case '3':
         /* C or POSIX locale.  */
         for (c = 0; c < 0x100; c++)
           if (c != 0)
@@ -85,6 +69,22 @@ main (int argc, char *argv[])
                 ASSERT (wc == c || wc == 0xDF00 + c);
             }
         return 0;
+
+      case '2':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        for (c = 0; c < 0x80; c++)
+          ASSERT (btowc (c) == c);
+        for (c = 0xA0; c < 0x100; c++)
+          ASSERT (btowc (c) != WEOF);
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        for (c = 0; c < 0x80; c++)
+          ASSERT (btowc (c) == c);
+        for (c = 0x80; c < 0x100; c++)
+          ASSERT (btowc (c) == WEOF);
+        return 0;
       }
 
   return 1;
diff --git a/tests/test-btowc1.sh b/tests/test-btowc1.sh
deleted file mode 100755 (executable)
index e51e1c5..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/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-btowc${EXEEXT} 1
diff --git a/tests/test-btowc2.sh b/tests/test-btowc2.sh
deleted file mode 100755 (executable)
index 9f38f4e..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/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-btowc${EXEEXT} 2
diff --git a/tests/test-btowc3.sh b/tests/test-btowc3.sh
deleted file mode 100755 (executable)
index ee9e143..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-# Test whether the POSIX locale has encoding errors.
-LC_ALL=C \
-${CHECKER} ./test-btowc${EXEEXT} 3 || exit 1
-LC_ALL=POSIX \
-${CHECKER} ./test-btowc${EXEEXT} 3 || exit 1
-
-exit 0