From 60745587a2e0073df7fe4cb1ec462f423c8f2bb2 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 30 Mar 2023 13:20:29 +0200 Subject: [PATCH] mbrtowc tests: Add comment. * tests/test-mbrtowc.c: Add comment. * tests/test-mbrtowc5.sh: Use symmetric coding style. * doc/posix-functions/mbrtowc.texi: Update. --- ChangeLog | 7 +++++++ doc/posix-functions/mbrtowc.texi | 2 +- tests/test-mbrtowc.c | 2 ++ tests/test-mbrtowc5.sh | 7 +++++-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba75036c75..a118bfc950 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-03-30 Bruno Haible + + mbrtowc tests: Add comment. + * tests/test-mbrtowc.c: Add comment. + * tests/test-mbrtowc5.sh: Use symmetric coding style. + * doc/posix-functions/mbrtowc.texi: Update. + 2023-03-30 Bruno Haible stdlib tests: Check behaviour of C locale. diff --git a/doc/posix-functions/mbrtowc.texi b/doc/posix-functions/mbrtowc.texi index d663d11bd8..bcba3f4c53 100644 --- a/doc/posix-functions/mbrtowc.texi +++ b/doc/posix-functions/mbrtowc.texi @@ -14,7 +14,7 @@ Minix 3.1.8, HP-UX 11.00, IRIX 6.5, mingw. @item In the C or POSIX locales, this function can return @code{(size_t) -1} and set @code{errno} to @code{EILSEQ}: -glibc 2.23. +glibc 2.35. @item This function returns 0 instead of @code{(size_t) -2} when the input is empty: diff --git a/tests/test-mbrtowc.c b/tests/test-mbrtowc.c index 1fdf039c42..cf43011cad 100644 --- a/tests/test-mbrtowc.c +++ b/tests/test-mbrtowc.c @@ -367,6 +367,8 @@ main (int argc, char *argv[]) wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, buf, 1, &state); + /* POSIX:2018 says: "In the POSIX locale an [EILSEQ] error + cannot occur since all byte values are valid characters." */ ASSERT (ret == 1); if (c < 0x80) /* c is an ASCII character. */ diff --git a/tests/test-mbrtowc5.sh b/tests/test-mbrtowc5.sh index 490496de2b..4c6c6fe868 100755 --- a/tests/test-mbrtowc5.sh +++ b/tests/test-mbrtowc5.sh @@ -1,6 +1,9 @@ #!/bin/sh + # Test whether the POSIX locale has encoding errors. LC_ALL=C \ -${CHECKER} ./test-mbrtowc${EXEEXT} 5 || exit +${CHECKER} ./test-mbrtowc${EXEEXT} 5 || exit 1 LC_ALL=POSIX \ -${CHECKER} ./test-mbrtowc${EXEEXT} 5 +${CHECKER} ./test-mbrtowc${EXEEXT} 5 || exit 1 + +exit 0 -- 2.39.5