summaryrefslogtreecommitdiff
path: root/tests/unigbrk/test-u8-grapheme-next.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unigbrk/test-u8-grapheme-next.c')
-rw-r--r--tests/unigbrk/test-u8-grapheme-next.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/unigbrk/test-u8-grapheme-next.c b/tests/unigbrk/test-u8-grapheme-next.c
index 8a3e2723..da0fc807 100644
--- a/tests/unigbrk/test-u8-grapheme-next.c
+++ b/tests/unigbrk/test-u8-grapheme-next.c
@@ -1,5 +1,5 @@
/* Next grapheme cluster length test.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
@@ -33,14 +33,12 @@ test_u8_grapheme_next (const char *input, size_t n, size_t len)
const uint8_t *next = u8_grapheme_next (s, s + n);
if (next != s + len)
{
- size_t i;
-
if (next == NULL)
fputs ("u8_grapheme_next returned NULL", stderr);
else
fprintf (stderr, "u8_grapheme_next skipped %tu bytes", next - s);
fprintf (stderr, ", expected %zu:\n", len);
- for (i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
fprintf (stderr, " %02x", s[i]);
putc ('\n', stderr);
fflush (stderr);
@@ -76,5 +74,16 @@ main (void)
test_u8_grapheme_next ("e"ACUTE"x", 4, 3);
test_u8_grapheme_next ("e"ACUTE "e"ACUTE, 6, 3);
+ /* CR LF handling. */
+ test_u8_grapheme_next ("\r\nd", 3, 2);
+
+ /* Emoji modifier / ZWJ sequence. */
+ test_u8_grapheme_next ("\342\255\220\314\205\315\207\342\200\215\342\230\200",
+ 13, 13);
+
+ /* Regional indicators. */
+ test_u8_grapheme_next ("\360\237\207\251\360\237\207\252\360\237\207\253\360\237\207\267",
+ 16, 8);
+
return test_exit_status;
}