We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraphemeCursor::next_boundary()
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8fe7258129406b137529559157edd542
use unicode_segmentation::{GraphemeCursor, GraphemeIncomplete}; #[test] fn test_graphemes_chunked() { use GraphemeIncomplete::*; let chunk0 = "👩"; // 4 bytes let chunk1 = "\u{200d}🔬"; // 3 bytes + 4 bytes let full = &(chunk0.to_string() + chunk1); // 👩🔬 let mut 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 expected Ok(Some(7)), when instead it should be Ok(Some(11))
Ok(Some(7))
Ok(Some(11))
The text was updated successfully, but these errors were encountered:
Potentially related: #115
The chunking stuff is buggy around some states. I don't have the time to investigate this right now but happy to help someone who wants to.
Sorry, something went wrong.
No branches or pull requests
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8fe7258129406b137529559157edd542
the last assert panics and says that it expected
Ok(Some(7))
, when instead it should beOk(Some(11))
The text was updated successfully, but these errors were encountered: