summaryrefslogtreecommitdiff
path: root/tests/unigbrk/test-uc-is-grapheme-break.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unigbrk/test-uc-is-grapheme-break.c')
-rw-r--r--tests/unigbrk/test-uc-is-grapheme-break.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/tests/unigbrk/test-uc-is-grapheme-break.c b/tests/unigbrk/test-uc-is-grapheme-break.c
index 55defb3..70bd519 100644
--- a/tests/unigbrk/test-uc-is-grapheme-break.c
+++ b/tests/unigbrk/test-uc-is-grapheme-break.c
@@ -1,5 +1,5 @@
/* Grapheme cluster break function test.
- Copyright (C) 2010-2018 Free Software Foundation, Inc.
+ Copyright (C) 2010-2022 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
@@ -21,10 +21,13 @@
/* Specification. */
#include <unigbrk.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "unictype.h"
+
const char *
graphemebreakproperty_to_string (int gbp)
{
@@ -86,7 +89,9 @@ main (int argc, char *argv[])
char *comment;
const char *p;
ucs4_t prev;
- int last_compchar_prop;
+ int last_char_prop;
+ bool emoji_modifier_sequence;
+ bool emoji_modifier_sequence_before_last_char;
size_t ri_count;
lineno++;
@@ -97,7 +102,9 @@ main (int argc, char *argv[])
if (line[strspn (line, " \t\r\n")] == '\0')
continue;
- last_compchar_prop = -1;
+ last_char_prop = -1;
+ emoji_modifier_sequence = false;
+ emoji_modifier_sequence_before_last_char = false;
ri_count = 0;
prev = 0;
p = line;
@@ -144,13 +151,14 @@ main (int argc, char *argv[])
next = next_int;
}
- if ((last_compchar_prop == GBP_EB
- || last_compchar_prop == GBP_EBG)
- && uc_graphemeclusterbreak_property (next) == GBP_EM)
+ /* Skip unsupported rules involving 3 or more characters. */
+ if (last_char_prop == GBP_ZWJ
+ && emoji_modifier_sequence_before_last_char
+ && uc_is_property_extended_pictographic (next))
{
int prev_gbp = uc_graphemeclusterbreak_property (prev);
int next_gbp = uc_graphemeclusterbreak_property (next);
- fprintf (stderr, "%s:%d: skipping GB10: should join U+%04X (%s) "
+ fprintf (stderr, "%s:%d: skipping GB11: should join U+%04X (%s) "
"and U+%04X (%s)\n",
filename, lineno,
prev, graphemebreakproperty_to_string (prev_gbp),
@@ -183,10 +191,13 @@ main (int argc, char *argv[])
p += strspn (p, " \t\r\n");
prev = next;
- if (!(uc_graphemeclusterbreak_property (next) == GBP_EXTEND
- && (last_compchar_prop == GBP_EB
- || last_compchar_prop == GBP_EBG)))
- last_compchar_prop = uc_graphemeclusterbreak_property (next);
+ emoji_modifier_sequence_before_last_char = emoji_modifier_sequence;
+ emoji_modifier_sequence =
+ (emoji_modifier_sequence
+ && uc_graphemeclusterbreak_property (next) == GBP_EXTEND)
+ || uc_is_property_extended_pictographic (next);
+
+ last_char_prop = uc_graphemeclusterbreak_property (next);
if (uc_graphemeclusterbreak_property (next) == GBP_RI)
ri_count++;