Branch
Hash :
ccb60ee9
Author :
Date :
2025-04-12T12:45:40
is*_l, fnmatch tests: Avoid test failures on macOS 15.4. Reported by Daniel Collins <solemnwarning@solemnwarning.net> at <https://savannah.gnu.org/bugs/?67007>. * tests/test-isgraph_l.c (main): On macOS, disable test cases that fail on macOS 15.4. * tests/test-isprint_l.c (main): Likewise. * tests/test-ispunct_l.c (main): Likewise. * tests/test-fnmatch.c (main): Likewise.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
/* Test of ispunct_l() function.
Copyright (C) 2020-2025 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
#include <ctype.h>
#include "signature.h"
SIGNATURE_CHECK (ispunct_l, int, (int, locale_t));
#include <locale.h>
#include <stdio.h>
#include "macros.h"
static void
test_single_locale_common (locale_t locale)
{
int is;
/* Test EOF. */
is = ispunct_l (EOF, locale);
ASSERT (is == 0);
/* POSIX specifies in
<https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
no explicit list of punctuation or symbol characters. */
{
int c;
for (c = 0; c < 0x100; c++)
switch (c)
{
case '\t': case '\v': case '\f':
case ' ': case '!': case '"': case '#': case '%':
case '&': case '\'': case '(': case ')': case '*':
case '+': case ',': case '-': case '.': case '/':
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case ':': case ';': case '<': case '=': case '>':
case '?':
case 'A': case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y':
case 'Z':
case '[': case '\\': case ']': case '^': case '_':
case 'a': case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n': case 'o':
case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y':
case 'z': case '{': case '|': case '}': case '~':
/* c is in the ISO C "basic character set". */
is = ispunct_l ((unsigned char) c, locale);
switch (c)
{
case ' ':
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case 'A': case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y':
case 'Z':
case 'a': case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n': case 'o':
case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y':
case 'z':
/* c is an alphanumeric or space character. */
ASSERT (is == 0);
break;
case '!': case '"': case '#': case '%':
case '&': case '\'': case '(': case ')': case '*':
case '+': case ',': case '-': case '.': case '/':
case ':': case ';': case '<': case '=': case '>':
case '?':
case '[': case '\\': case ']': case '^': case '_':
case '{': case '|': case '}': case '~':
/* These characters are usually expected to be punctuation or
symbol characters. */
ASSERT (is != 0);
break;
default:
ASSERT (is == 0);
break;
}
break;
}
}
}
int
main ()
{
{
locale_t locale = newlocale (LC_ALL_MASK, "C", NULL);
ASSERT (locale != NULL);
test_single_locale_common (locale);
freelocale (locale);
}
#if !MUSL_LIBC /* musl libc has no unibyte locales */
{
# if defined _WIN32 && !defined __CYGWIN__
locale_t locale = newlocale (LC_ALL_MASK, "French_France.1252", NULL);
# else
locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.ISO-8859-1", NULL);
if (locale == NULL)
locale = newlocale (LC_ALL_MASK, "fr_FR.ISO8859-1", NULL);
# endif
if (locale != NULL)
{
test_single_locale_common (locale);
/* Locale encoding is ISO-8859-1 or ISO-8859-15. */
int is;
#if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__)
/* U+00BF INVERTED QUESTION MARK */
is = ispunct_l ((unsigned char) '\277', locale);
ASSERT (is != 0);
#endif
#if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
/* U+00D7 MULTIPLICATION SIGN */
is = ispunct_l ((unsigned char) '\327', locale);
ASSERT (is != 0);
#endif
/* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
is = ispunct_l ((unsigned char) '\330', locale);
ASSERT (is == 0);
/* U+00DF LATIN SMALL LETTER SHARP S */
is = ispunct_l ((unsigned char) '\337', locale);
ASSERT (is == 0);
freelocale (locale);
}
}
#endif
return test_exit_status;
}