summaryrefslogtreecommitdiff
path: root/tests/unigbrk/test-uc-is-grapheme-break.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-01-08 11:51:07 +0100
committerJörg Frings-Fürst <debian@jff.email>2022-01-08 11:51:07 +0100
commitbe8efac78d067c138ad8dda03df4336e73f94887 (patch)
tree5f5254a628ba0ef72065b93d949d1c985742ea8e /tests/unigbrk/test-uc-is-grapheme-break.c
parent7b65dbd4ebade81d504cfe5e681292a58ad1fdf0 (diff)
New upstream version 1.0upstream/1.0
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++;