From f8dd25c325449b0f0c1e7655057070fdeb602486 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 23 Oct 2010 13:38:11 +0200 Subject: [PATCH] Tests: Fix LOCALE_JA on MirBSD 10. * m4/locale-ja.m4 (gt_LOCALE_JA): Reject a locale identifier that leads to an UTF-8 locale. * m4/locale-fr.m4 (gt_LOCALE_FR): Likewise. * m4/locale-zh.m4 (gt_LOCALE_ZH_CN): Likewise. Reported by Eric Blake. --- ChangeLog | 9 +++++++++ m4/locale-fr.m4 | 9 ++++++--- m4/locale-ja.m4 | 11 +++++++---- m4/locale-zh.m4 | 11 +++++++---- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1239a1092..be3c9bd17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-10-23 Bruno Haible + + Tests: Fix LOCALE_JA on MirBSD 10. + * m4/locale-ja.m4 (gt_LOCALE_JA): Reject a locale identifier that leads + to an UTF-8 locale. + * m4/locale-fr.m4 (gt_LOCALE_FR): Likewise. + * m4/locale-zh.m4 (gt_LOCALE_ZH_CN): Likewise. + Reported by Eric Blake. + 2010-10-21 Bruno Haible nl_langinfo test: Avoid test failure on NetBSD 5. diff --git a/m4/locale-fr.m4 b/m4/locale-fr.m4 index 001f53906..e3534321d 100644 --- a/m4/locale-fr.m4 +++ b/m4/locale-fr.m4 @@ -1,4 +1,4 @@ -# locale-fr.m4 serial 11 +# locale-fr.m4 serial 12 dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -31,11 +31,14 @@ int main () { is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, - some unit tests fail. */ + some unit tests fail. + On MirBSD 10, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "UTF-8". */ #if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); - if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 + || strcmp (cs, "UTF-8") == 0) return 1; } #endif diff --git a/m4/locale-ja.m4 b/m4/locale-ja.m4 index 0eedaf149..316840025 100644 --- a/m4/locale-ja.m4 +++ b/m4/locale-ja.m4 @@ -1,4 +1,4 @@ -# locale-ja.m4 serial 7 +# locale-ja.m4 serial 8 dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -33,11 +33,14 @@ int main () is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, - some unit tests fail. */ + some unit tests fail. + On MirBSD 10, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "UTF-8". */ #if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); - if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 + || strcmp (cs, "UTF-8") == 0) return 1; } #endif @@ -52,7 +55,7 @@ int main () if (MB_CUR_MAX == 1) return 1; /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. - This excludes the UTF-8 encoding. */ + This excludes the UTF-8 encoding (except on MirBSD). */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) diff --git a/m4/locale-zh.m4 b/m4/locale-zh.m4 index 777fd1418..be176c15e 100644 --- a/m4/locale-zh.m4 +++ b/m4/locale-zh.m4 @@ -1,4 +1,4 @@ -# locale-zh.m4 serial 6 +# locale-zh.m4 serial 7 dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -34,11 +34,14 @@ int main () is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, - some unit tests fail. */ + some unit tests fail. + On MirBSD 10, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "UTF-8". */ #if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); - if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 + || strcmp (cs, "UTF-8") == 0) return 1; } #endif @@ -49,7 +52,7 @@ int main () if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; #endif /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. - This excludes the UTF-8 encoding. */ + This excludes the UTF-8 encoding (except on MirBSD). */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) -- 2.11.0