Skip to content

Commit

Permalink
doc test for unicode-org#4146
Browse files Browse the repository at this point in the history
  • Loading branch information
eggrobin committed Dec 1, 2023
1 parent ea5ddc7 commit 8a1cb70
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions components/segmenter/src/line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,21 @@ pub type LineBreakIteratorUtf16<'l, 's> = LineBreakIterator<'l, 's, LineBreakTyp
/// let breakpoints: Vec<usize> = segmenter.segment_str(text).collect();
/// // 9 and 22 are mandatory breaks, 14 is a line break opportunity.
/// assert_eq!(&breakpoints, &[0, 9, 14, 22]);
///
/// // There is a break opportunity between emoji, but not within the ZWJ sequence 🏳️‍🌈.
/// let flag_equation = "🏳️➕🌈🟰🏳️\u{200D}🌈";
/// let possible_first_lines: Vec<&str> =
/// segmenter.segment_str(flag_equation).skip(1).map(|i| &flag_equation[..i]).collect();
/// assert_eq!(
/// &possible_first_lines,
/// &[
/// "🏳️",
/// "🏳️➕",
/// "🏳️➕🌈",
/// "🏳️➕🌈🟰",
/// "🏳️➕🌈🟰🏳️‍🌈"
/// ]
/// );
/// ```
///
/// # Examples
Expand Down

0 comments on commit 8a1cb70

Please sign in to comment.