Skip to content

Commit

Permalink
Add a grapheme cluster test for emoji flags (#4781)
Browse files Browse the repository at this point in the history
Fixed #4780.
  • Loading branch information
aethanyc authored Apr 8, 2024
1 parent f0f6060 commit 16b770c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/segmenter/src/grapheme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,11 @@ fn empty_string() {
let breaks: Vec<usize> = segmenter.segment_str("").collect();
assert_eq!(breaks, [0]);
}

#[test]
fn emoji_flags() {
// https://github.com/unicode-org/icu4x/issues/4780
let segmenter = GraphemeClusterSegmenter::new();
let breaks: Vec<usize> = segmenter.segment_str("🇺🇸🏴󠁧󠁢󠁥󠁮󠁧󠁿").collect();
assert_eq!(breaks, [0, 8, 36]);
}

0 comments on commit 16b770c

Please sign in to comment.