- Notifications
You must be signed in to change notification settings - Fork61
Open
Description
The first time, the chunk containing both [man] and [zwj] is passed into provideContext at the same time. This works and returns the expected result. The second time, the chunk containing [zwj] is provided first, and then the chunk containing [man] is provided. This doesn't work and returns 'true' as if there is a boundary in the middle of an emoji.
#[cfg(test)]mod tests{use unicode_segmentation::{GraphemeCursor,GraphemeIncomplete::*};const family_emoji:&str ="A\u{1F468}\u{200D}\u{1F469}\u{1F467}B";// "A👨👩👧👧B" : [0: A] [1: MAN] [5: Zero Width Joiner] [8: WOMAN] [12: GIRL] [16: B]#[test]fnpasses(){letmut cursor =GraphemeCursor::new(8, family_emoji.len(),true);assert_eq!(cursor.is_boundary(&family_emoji[8..],8),Err(PreContext(8))); cursor.provide_context(&family_emoji[1..8],1);assert_eq!(cursor.is_boundary(&family_emoji[8..],8),Ok(false));}#[test]fnfails(){letmut cursor =GraphemeCursor::new(8, family_emoji.len(),true);assert_eq!(cursor.is_boundary(&family_emoji[8..],8),Err(PreContext(8))); cursor.provide_context(&family_emoji[5..8],5);assert_eq!(cursor.is_boundary(&family_emoji[8..],8),Err(PreContext(5))); cursor.provide_context(&family_emoji[1..5],1);assert_eq!(cursor.is_boundary(&family_emoji[8..],8),Ok(false));}}
Potentially related:#118
Metadata
Metadata
Assignees
Labels
No labels