summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-04-03 14:24:37 +0200
committerBruno Haible <bruno@clisp.org>2023-04-03 14:24:37 +0200
commit09a9ccc95ddd3e4ffbf386cca440b944c91d3412 (patch)
treed4de83c726e350ce34ae12fddea784721234cafe /tests
parentb330f8630dff4d43f4bc3e8868b4b8374cb37e0d (diff)
downloadgnulib-09a9ccc95ddd3e4ffbf386cca440b944c91d3412.tar.gz
mbrtoc32 tests: Add comment.
* m4/mbrtowc.m4 (gl_MBRTOWC_C_LOCALE): Add comment. * m4/mbrtoc32.m4 (gl_MBRTOC32_C_LOCALE): Add comment. * tests/test-mbrtoc32.c: Add comment. * tests/test-mbrtoc32-5.sh: Use symmetric coding style. * doc/posix-functions/mbrtoc32.texi: Update.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test-mbrtoc32-5.sh7
-rw-r--r--tests/test-mbrtoc32.c4
2 files changed, 9 insertions, 2 deletions
diff --git a/tests/test-mbrtoc32-5.sh b/tests/test-mbrtoc32-5.sh
index cd000fb3c7..4213772272 100755
--- a/tests/test-mbrtoc32-5.sh
+++ b/tests/test-mbrtoc32-5.sh
@@ -1,6 +1,9 @@
#!/bin/sh
+
# Test whether the POSIX locale has encoding errors.
LC_ALL=C \
-${CHECKER} ./test-mbrtoc32${EXEEXT} 5 || exit
+${CHECKER} ./test-mbrtoc32${EXEEXT} 5 || exit 1
LC_ALL=POSIX \
-${CHECKER} ./test-mbrtoc32${EXEEXT} 5
+${CHECKER} ./test-mbrtoc32${EXEEXT} 5 || exit 1
+
+exit 0
diff --git a/tests/test-mbrtoc32.c b/tests/test-mbrtoc32.c
index 0d75c3db14..a40309004e 100644
--- a/tests/test-mbrtoc32.c
+++ b/tests/test-mbrtoc32.c
@@ -386,6 +386,10 @@ main (int argc, char *argv[])
wc = (char32_t) 0xBADFACE;
ret = mbrtoc32 (&wc, buf, 1, &state);
+ /* POSIX:2018 says regarding mbrtowc: "In the POSIX locale an
+ [EILSEQ] error cannot occur since all byte values are valid
+ characters." It is reasonable to expect mbrtoc32 to behave
+ in the same way. */
ASSERT (ret == 1);
if (c < 0x80)
/* c is an ASCII character. */