Skip to content

Commit 0e7674a

Browse files
committed
remove pub
1 parent b556333 commit 0e7674a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/word.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ impl<'a> UWordBounds<'a> {
756756
///
757757
/// Any other single ASCII byte is its own boundary (the default WB999).
758758
#[derive(Debug)]
759-
pub struct AsciiWordBoundIter<'a> {
759+
struct AsciiWordBoundIter<'a> {
760760
rest: &'a str,
761761
offset: usize,
762762
}
@@ -988,7 +988,7 @@ pub fn new_word_bound_indices(s: &str) -> UWordBoundIndices<'_> {
988988
}
989989

990990
#[inline]
991-
pub fn new_ascii_word_bound_indices(s: &str) -> AsciiWordBoundIter<'_> {
991+
fn new_ascii_word_bound_indices(s: &str) -> AsciiWordBoundIter<'_> {
992992
AsciiWordBoundIter::new(s)
993993
}
994994

@@ -1046,6 +1046,20 @@ mod tests {
10461046
assert_eq!(cat, wd::WC_Numeric);
10471047
}
10481048

1049+
#[test]
1050+
fn test_ascii_word_bound_indices_various_cases() {
1051+
let s = "Hello, world!";
1052+
let words: Vec<(usize, &str)> = new_ascii_word_bound_indices(s).collect();
1053+
let expected = vec![
1054+
(0, "Hello"), // simple letters
1055+
(5, ","),
1056+
(6, " "), // space after comma
1057+
(7, "world"), // skip comma+space, stop at '!'
1058+
(12, "!"), // punctuation at the end
1059+
];
1060+
assert_eq!(words, expected);
1061+
}
1062+
10491063
#[test]
10501064
fn test_ascii_word_indices_various_cases() {
10511065
let s = "Hello, world! can't e.g. var1 123,456 foo_bar example.com 127.0.0.1:9090";

0 commit comments

Comments
 (0)