From b037ed51f0e25671da47611ca27a4f45f0c9ada9 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 12 Dec 2019 13:02:28 +0100 Subject: [PATCH] wcwidth: Avoid test failure on AIX 7.2. * tests/test-wcwidth.c (main): Don't fail if wcwidth(0x200B) is negative. * doc/posix-functions/wcwidth.texi: Mention the AIX issue. --- ChangeLog | 7 +++++++ doc/posix-functions/wcwidth.texi | 4 ++++ tests/test-wcwidth.c | 6 +++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d62eb6145f..5d1df96cfd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2019-12-12 Bruno Haible + + wcwidth: Avoid test failure on AIX 7.2. + * tests/test-wcwidth.c (main): Don't fail if wcwidth(0x200B) is + negative. + * doc/posix-functions/wcwidth.texi: Mention the AIX issue. + 2019-12-12 Bruno Haible ilogbl: Work around Cygwin bug. diff --git a/doc/posix-functions/wcwidth.texi b/doc/posix-functions/wcwidth.texi index 0acc1c4aff..a3afe9ba0d 100644 --- a/doc/posix-functions/wcwidth.texi +++ b/doc/posix-functions/wcwidth.texi @@ -29,4 +29,8 @@ Portability problems not fixed by Gnulib: @item On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. +@item +This function treats zero-width spaces like control characters on some +platforms: +AIX 7.2. @end itemize diff --git a/tests/test-wcwidth.c b/tests/test-wcwidth.c index 8e9cea3e49..ecb50cd00f 100644 --- a/tests/test-wcwidth.c +++ b/tests/test-wcwidth.c @@ -69,7 +69,11 @@ main () #endif /* Test width of some zero width characters. */ - ASSERT (wcwidth (0x200B) == 0); + /* While it is desirable that U+200B, U+200C, U+200D have width 0, + because this makes wcswidth work better on strings that contain these + characters, it is acceptable if an implementation treats these + characters like control characters. */ + ASSERT (wcwidth (0x200B) <= 0); ASSERT (wcwidth (0xFEFF) <= 0); /* Test width of some math symbols. -- 2.39.5