- Notifications
You must be signed in to change notification settings - Fork61
Open
Description
use unicode_segmentation::{GraphemeCursor,GraphemeIncomplete};#[test]fntest_graphemes_chunked(){useGraphemeIncomplete::*;let chunk0 ="👩";// 4 byteslet chunk1 ="\u{200d}🔬";// 3 bytes + 4 byteslet full =&(chunk0.to_string() + chunk1);// 👩🔬letmut cur =GraphemeCursor::new(0, full.len(),true);assert_eq!(cur.next_boundary(chunk0,0),Err(NextChunk));match cur.next_boundary(chunk1, chunk0.len()){Ok(res) =>assert_eq!(res,Some(11)),Err(PreContext(_)) =>{ cur.provide_context(chunk0,0);assert_eq!(cur.next_boundary(chunk1, chunk0.len()),Ok(Some(11)));} _ =>unreachable!(),}}
the last assert panics and says that it expectedOk(Some(7))
, when instead it should beOk(Some(11))
Metadata
Metadata
Assignees
Labels
No labels