1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-03-01 10:33:30 +02:00

tests: avoid test failure on Android

* gl/tests/test-mbsalign.c (main): Skip the unibyte truncation test
on Android, when the "C" locale in fact is multibyte.
This commit is contained in:
Bruno Haible
2023-08-28 12:07:18 +02:00
committed by Pádraig Brady
parent 9348edb6b6
commit c8340962dd

View File

@@ -29,10 +29,19 @@ main (void)
char dest[4 * 16 + 1];
size_t width, n;
/* Test unibyte truncation. */
width = 4;
n = mbsalign ("t\tés", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
ASSERT (n == 4);
#ifdef __ANDROID__
/* On Android ≥ 5.0, the default locale is the "C.UTF-8" locale, not the
"C" locale. Furthermore, when you attempt to set the "C" or "POSIX"
locale via setlocale(), what you get is a "C" locale with UTF-8 encoding,
that is, effectively the "C.UTF-8" locale. */
if (MB_CUR_MAX == 1)
#endif
{
/* Test unibyte truncation. */
width = 4;
n = mbsalign ("t\tés", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
ASSERT (n == 4);
}
/* Test center alignment. */
width = 4;