diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2022-01-08 11:51:39 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2022-01-08 11:51:39 +0100 |
commit | 2959e59fab3bab834368adefd90bd4b1b094366b (patch) | |
tree | 7d0ae09775ea950056193eaa2ca93844299d46f1 /tests/unigbrk/test-uc-is-grapheme-break.c | |
parent | c78359d9542c86b972aac373efcf7bc7a8a560e5 (diff) | |
parent | be8efac78d067c138ad8dda03df4336e73f94887 (diff) |
Update upstream source from tag 'upstream/1.0'
Update to upstream version '1.0'
with Debian dir 4875e7dc9f7277205f0086a63ee21ccdb1d54593
Diffstat (limited to 'tests/unigbrk/test-uc-is-grapheme-break.c')
-rw-r--r-- | tests/unigbrk/test-uc-is-grapheme-break.c | 33 |
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 55defb3d..70bd5197 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++; |