From: Bruno Haible Date: Sat, 29 Jul 2023 20:50:44 +0000 (+0200) Subject: fnmatch tests: Renumber tests. X-Git-Tag: v1.0~1007 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=957d4b3c33384228da4091e407640bcd16d00c71;p=gnulib.git fnmatch tests: Renumber tests. * tests/test-fnmatch-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8. * tests/test-fnmatch-w32.c: Update. * modules/fnmatch-tests: Update. --- diff --git a/ChangeLog b/ChangeLog index adb9d83352..29b298d931 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2023-07-29 Bruno Haible + fnmatch tests: Renumber tests. + * tests/test-fnmatch-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 + -> 8. + * tests/test-fnmatch-w32.c: Update. + * modules/fnmatch-tests: Update. + c32stombs tests: Renumber tests. * tests/test-c32stombs-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5. * tests/test-c32stombs.c: Update. diff --git a/modules/fnmatch-tests b/modules/fnmatch-tests index 30ec4fded6..8dbb7330ed 100644 --- a/modules/fnmatch-tests +++ b/modules/fnmatch-tests @@ -5,13 +5,13 @@ tests/test-fnmatch-3.sh tests/test-fnmatch-4.sh tests/test-fnmatch-5.sh tests/test-fnmatch.c -tests/test-fnmatch-w32-1.sh tests/test-fnmatch-w32-2.sh tests/test-fnmatch-w32-3.sh tests/test-fnmatch-w32-4.sh tests/test-fnmatch-w32-5.sh tests/test-fnmatch-w32-6.sh tests/test-fnmatch-w32-7.sh +tests/test-fnmatch-w32-8.sh tests/test-fnmatch-w32.c tests/signature.h tests/macros.h @@ -36,9 +36,9 @@ Makefile.am: TESTS += \ test-fnmatch-1.sh test-fnmatch-2.sh test-fnmatch-3.sh test-fnmatch-4.sh \ test-fnmatch-5.sh \ - test-fnmatch-w32-1.sh test-fnmatch-w32-2.sh test-fnmatch-w32-3.sh \ - test-fnmatch-w32-4.sh test-fnmatch-w32-5.sh test-fnmatch-w32-6.sh \ - test-fnmatch-w32-7.sh + test-fnmatch-w32-2.sh test-fnmatch-w32-3.sh test-fnmatch-w32-4.sh \ + test-fnmatch-w32-5.sh test-fnmatch-w32-6.sh test-fnmatch-w32-7.sh \ + test-fnmatch-w32-8.sh TESTS_ENVIRONMENT += \ LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ diff --git a/tests/test-fnmatch-w32-1.sh b/tests/test-fnmatch-w32-1.sh deleted file mode 100755 index 6efe31fe9c..0000000000 --- a/tests/test-fnmatch-w32-1.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -# Test a CP1252 locale. -${CHECKER} ./test-fnmatch-w32${EXEEXT} French_France 1252 diff --git a/tests/test-fnmatch-w32-2.sh b/tests/test-fnmatch-w32-2.sh index aacf62a3f7..6efe31fe9c 100755 --- a/tests/test-fnmatch-w32-2.sh +++ b/tests/test-fnmatch-w32-2.sh @@ -1,4 +1,4 @@ #!/bin/sh -# Test a CP1256 locale. -${CHECKER} ./test-fnmatch-w32${EXEEXT} "Arabic_Saudi Arabia" 1256 +# Test a CP1252 locale. +${CHECKER} ./test-fnmatch-w32${EXEEXT} French_France 1252 diff --git a/tests/test-fnmatch-w32-3.sh b/tests/test-fnmatch-w32-3.sh index 56c8ef1ae6..aacf62a3f7 100755 --- a/tests/test-fnmatch-w32-3.sh +++ b/tests/test-fnmatch-w32-3.sh @@ -1,4 +1,4 @@ #!/bin/sh -# Test a CP932 locale. -${CHECKER} ./test-fnmatch-w32${EXEEXT} Japanese_Japan 932 +# Test a CP1256 locale. +${CHECKER} ./test-fnmatch-w32${EXEEXT} "Arabic_Saudi Arabia" 1256 diff --git a/tests/test-fnmatch-w32-4.sh b/tests/test-fnmatch-w32-4.sh index e3c518115d..15f26faa9a 100755 --- a/tests/test-fnmatch-w32-4.sh +++ b/tests/test-fnmatch-w32-4.sh @@ -1,4 +1,4 @@ #!/bin/sh -# Test a CP950 locale. -${CHECKER} ./test-fnmatch-w32${EXEEXT} Chinese_Taiwan 950 +# Test some UTF-8 locales. +${CHECKER} ./test-fnmatch-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001 diff --git a/tests/test-fnmatch-w32-5.sh b/tests/test-fnmatch-w32-5.sh index 0c2a048db2..56c8ef1ae6 100755 --- a/tests/test-fnmatch-w32-5.sh +++ b/tests/test-fnmatch-w32-5.sh @@ -1,4 +1,4 @@ #!/bin/sh -# Test a CP936 locale. -${CHECKER} ./test-fnmatch-w32${EXEEXT} Chinese_China 936 +# Test a CP932 locale. +${CHECKER} ./test-fnmatch-w32${EXEEXT} Japanese_Japan 932 diff --git a/tests/test-fnmatch-w32-6.sh b/tests/test-fnmatch-w32-6.sh index af024428e6..e3c518115d 100755 --- a/tests/test-fnmatch-w32-6.sh +++ b/tests/test-fnmatch-w32-6.sh @@ -1,4 +1,4 @@ #!/bin/sh -# Test a GB18030 locale. -${CHECKER} ./test-fnmatch-w32${EXEEXT} Chinese_China 54936 +# Test a CP950 locale. +${CHECKER} ./test-fnmatch-w32${EXEEXT} Chinese_Taiwan 950 diff --git a/tests/test-fnmatch-w32-7.sh b/tests/test-fnmatch-w32-7.sh index 15f26faa9a..0c2a048db2 100755 --- a/tests/test-fnmatch-w32-7.sh +++ b/tests/test-fnmatch-w32-7.sh @@ -1,4 +1,4 @@ #!/bin/sh -# Test some UTF-8 locales. -${CHECKER} ./test-fnmatch-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001 +# Test a CP936 locale. +${CHECKER} ./test-fnmatch-w32${EXEEXT} Chinese_China 936 diff --git a/tests/test-fnmatch-w32-8.sh b/tests/test-fnmatch-w32-8.sh new file mode 100755 index 0000000000..af024428e6 --- /dev/null +++ b/tests/test-fnmatch-w32-8.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +# Test a GB18030 locale. +${CHECKER} ./test-fnmatch-w32${EXEEXT} Chinese_China 54936 diff --git a/tests/test-fnmatch-w32.c b/tests/test-fnmatch-w32.c index 1eb280a2a0..3768178375 100644 --- a/tests/test-fnmatch-w32.c +++ b/tests/test-fnmatch-w32.c @@ -144,6 +144,88 @@ test_one_locale (const char *name, int codepage) return 0; + case 65001: + /* Locale encoding is CP65001 = UTF-8. */ + if (strcmp (locale_charset (), "UTF-8") != 0) + return 77; + + ASSERT (fnmatch ("x?y", "x\303\274y", 0) == 0); /* "xüy" */ + ASSERT (fnmatch ("x?y", "x\303\237y", 0) == 0); /* "xßy" */ + ASSERT (fnmatch ("x?y", "x\360\237\230\213y", 0) == 0); /* "x😋y" */ + /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ + ASSERT (fnmatch ("x[[:alnum:]]y", "x\305\201y", 0) == 0); + /* U+10330 GOTHIC LETTER AHSA */ + ASSERT (fnmatch ("x[[:alnum:]]y", "x\360\220\214\260y", 0) == 0); + /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ + ASSERT (fnmatch ("x[[:alpha:]]y", "x\305\201y", 0) == 0); + /* U+10330 GOTHIC LETTER AHSA */ + ASSERT (fnmatch ("x[[:alpha:]]y", "x\360\220\214\260y", 0) == 0); + /* U+00B8 CEDILLA */ + ASSERT (fnmatch ("x[[:graph:]]y", "x\302\270y", 0) == 0); + /* U+20000 */ + ASSERT (fnmatch ("x[[:graph:]]y", "x\360\240\200\200y", 0) == 0); + /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ + ASSERT (fnmatch ("x[[:lower:]]y", "x\303\277y", 0) == 0); + /* U+10441 DESERET SMALL LETTER EF */ + ASSERT (fnmatch ("x[[:lower:]]y", "x\360\220\221\201y", 0) == 0); + /* U+00B8 CEDILLA */ + ASSERT (fnmatch ("x[[:print:]]y", "x\302\270y", 0) == 0); + /* U+20000 */ + ASSERT (fnmatch ("x[[:print:]]y", "x\360\240\200\200y", 0) == 0); + /* U+00BF INVERTED QUESTION MARK */ + ASSERT (fnmatch ("x[[:punct:]]y", "x\302\277y", 0) == 0); + /* U+1D100 MUSICAL SYMBOL SINGLE BARLINE */ + ASSERT (fnmatch ("x[[:punct:]]y", "x\360\235\204\200y", 0) == 0); + /* U+3000 IDEOGRAPHIC SPACE */ + ASSERT (fnmatch ("x[[:space:]]y", "x\343\200\200y", 0) == 0); + /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */ + ASSERT (fnmatch ("x[[:upper:]]y", "x\320\251y", 0) == 0); + /* U+10419 DESERET CAPITAL LETTER EF */ + ASSERT (fnmatch ("x[[:upper:]]y", "x\360\220\220\231y", 0) == 0); + /* U+00D7 MULTIPLICATION SIGN */ + ASSERT (fnmatch ("x[[:alnum:]]y", "x\303\227y", 0) == FNM_NOMATCH); + /* U+00D7 MULTIPLICATION SIGN */ + ASSERT (fnmatch ("x[[:alpha:]]y", "x\303\227y", 0) == FNM_NOMATCH); + /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ + ASSERT (fnmatch ("x[[:blank:]]y", "x\305\201y", 0) == FNM_NOMATCH); + /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ + ASSERT (fnmatch ("x[[:cntrl:]]y", "x\305\201y", 0) == FNM_NOMATCH); + /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ + ASSERT (fnmatch ("x[[:digit:]]y", "x\305\201y", 0) == FNM_NOMATCH); + /* U+2002 EN SPACE */ + ASSERT (fnmatch ("x[[:graph:]]y", "x\342\200\202y", 0) == FNM_NOMATCH); + /* U+00B2 SUPERSCRIPT TWO */ + ASSERT (fnmatch ("x[[:lower:]]y", "x\302\262y", 0) == FNM_NOMATCH); + /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ + ASSERT (fnmatch ("x[[:punct:]]y", "x\305\201y", 0) == FNM_NOMATCH); + /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ + ASSERT (fnmatch ("x[[:space:]]y", "x\305\201y", 0) == FNM_NOMATCH); + /* U+00B2 SUPERSCRIPT TWO */ + ASSERT (fnmatch ("x[[:upper:]]y", "x\302\262y", 0) == FNM_NOMATCH); + /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ + ASSERT (fnmatch ("x[[:xdigit:]]y", "x\305\201y", 0) == FNM_NOMATCH); + + #if GNULIB_FNMATCH_GNU && defined FNM_CASEFOLD + /* "özgür" */ + { + /* Some platforms, e.g. MSVC 14, lack the upper/lower mappings for + these wide characters in the *.65001 locales. */ + mbstate_t state; + wchar_t wc; + memset (&state, 0, sizeof (mbstate_t)); + if (mbrtowc (&wc, "\303\274", 2, &state) == 2 + && towupper (wc) != wc) + { + ASSERT (fnmatch ("\303\266zg\303\274r", "\303\226ZG\303\234R", FNM_CASEFOLD) == 0); + ASSERT (fnmatch ("\303\226ZG\303\234R", "\303\266zg\303\274r", FNM_CASEFOLD) == 0); + ASSERT (fnmatch ("\303\266Zg\303\234r", "\303\226zG\303\274R", FNM_CASEFOLD) == 0); + ASSERT (fnmatch ("\303\226zG\303\274R", "\303\266Zg\303\234r", FNM_CASEFOLD) == 0); + } + } + #endif + + return 0; + case 932: /* Locale encoding is CP932, similar to Shift_JIS. */ @@ -288,88 +370,6 @@ test_one_locale (const char *name, int codepage) return 0; - case 65001: - /* Locale encoding is CP65001 = UTF-8. */ - if (strcmp (locale_charset (), "UTF-8") != 0) - return 77; - - ASSERT (fnmatch ("x?y", "x\303\274y", 0) == 0); /* "xüy" */ - ASSERT (fnmatch ("x?y", "x\303\237y", 0) == 0); /* "xßy" */ - ASSERT (fnmatch ("x?y", "x\360\237\230\213y", 0) == 0); /* "x😋y" */ - /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ - ASSERT (fnmatch ("x[[:alnum:]]y", "x\305\201y", 0) == 0); - /* U+10330 GOTHIC LETTER AHSA */ - ASSERT (fnmatch ("x[[:alnum:]]y", "x\360\220\214\260y", 0) == 0); - /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ - ASSERT (fnmatch ("x[[:alpha:]]y", "x\305\201y", 0) == 0); - /* U+10330 GOTHIC LETTER AHSA */ - ASSERT (fnmatch ("x[[:alpha:]]y", "x\360\220\214\260y", 0) == 0); - /* U+00B8 CEDILLA */ - ASSERT (fnmatch ("x[[:graph:]]y", "x\302\270y", 0) == 0); - /* U+20000 */ - ASSERT (fnmatch ("x[[:graph:]]y", "x\360\240\200\200y", 0) == 0); - /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ - ASSERT (fnmatch ("x[[:lower:]]y", "x\303\277y", 0) == 0); - /* U+10441 DESERET SMALL LETTER EF */ - ASSERT (fnmatch ("x[[:lower:]]y", "x\360\220\221\201y", 0) == 0); - /* U+00B8 CEDILLA */ - ASSERT (fnmatch ("x[[:print:]]y", "x\302\270y", 0) == 0); - /* U+20000 */ - ASSERT (fnmatch ("x[[:print:]]y", "x\360\240\200\200y", 0) == 0); - /* U+00BF INVERTED QUESTION MARK */ - ASSERT (fnmatch ("x[[:punct:]]y", "x\302\277y", 0) == 0); - /* U+1D100 MUSICAL SYMBOL SINGLE BARLINE */ - ASSERT (fnmatch ("x[[:punct:]]y", "x\360\235\204\200y", 0) == 0); - /* U+3000 IDEOGRAPHIC SPACE */ - ASSERT (fnmatch ("x[[:space:]]y", "x\343\200\200y", 0) == 0); - /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */ - ASSERT (fnmatch ("x[[:upper:]]y", "x\320\251y", 0) == 0); - /* U+10419 DESERET CAPITAL LETTER EF */ - ASSERT (fnmatch ("x[[:upper:]]y", "x\360\220\220\231y", 0) == 0); - /* U+00D7 MULTIPLICATION SIGN */ - ASSERT (fnmatch ("x[[:alnum:]]y", "x\303\227y", 0) == FNM_NOMATCH); - /* U+00D7 MULTIPLICATION SIGN */ - ASSERT (fnmatch ("x[[:alpha:]]y", "x\303\227y", 0) == FNM_NOMATCH); - /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ - ASSERT (fnmatch ("x[[:blank:]]y", "x\305\201y", 0) == FNM_NOMATCH); - /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ - ASSERT (fnmatch ("x[[:cntrl:]]y", "x\305\201y", 0) == FNM_NOMATCH); - /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ - ASSERT (fnmatch ("x[[:digit:]]y", "x\305\201y", 0) == FNM_NOMATCH); - /* U+2002 EN SPACE */ - ASSERT (fnmatch ("x[[:graph:]]y", "x\342\200\202y", 0) == FNM_NOMATCH); - /* U+00B2 SUPERSCRIPT TWO */ - ASSERT (fnmatch ("x[[:lower:]]y", "x\302\262y", 0) == FNM_NOMATCH); - /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ - ASSERT (fnmatch ("x[[:punct:]]y", "x\305\201y", 0) == FNM_NOMATCH); - /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ - ASSERT (fnmatch ("x[[:space:]]y", "x\305\201y", 0) == FNM_NOMATCH); - /* U+00B2 SUPERSCRIPT TWO */ - ASSERT (fnmatch ("x[[:upper:]]y", "x\302\262y", 0) == FNM_NOMATCH); - /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ - ASSERT (fnmatch ("x[[:xdigit:]]y", "x\305\201y", 0) == FNM_NOMATCH); - - #if GNULIB_FNMATCH_GNU && defined FNM_CASEFOLD - /* "özgür" */ - { - /* Some platforms, e.g. MSVC 14, lack the upper/lower mappings for - these wide characters in the *.65001 locales. */ - mbstate_t state; - wchar_t wc; - memset (&state, 0, sizeof (mbstate_t)); - if (mbrtowc (&wc, "\303\274", 2, &state) == 2 - && towupper (wc) != wc) - { - ASSERT (fnmatch ("\303\266zg\303\274r", "\303\226ZG\303\234R", FNM_CASEFOLD) == 0); - ASSERT (fnmatch ("\303\226ZG\303\234R", "\303\266zg\303\274r", FNM_CASEFOLD) == 0); - ASSERT (fnmatch ("\303\266Zg\303\234r", "\303\226zG\303\274R", FNM_CASEFOLD) == 0); - ASSERT (fnmatch ("\303\226zG\303\274R", "\303\266Zg\303\234r", FNM_CASEFOLD) == 0); - } - } - #endif - - return 0; - default: return 1; }