1
0
зеркало из https://github.com/glebtv/tui-textarea.git synced 2026-09-03 22:35:50 +03:00

add more tests for search feature

Этот коммит содержится в:
rhysd
2024-08-05 00:02:11 +09:00
родитель 474b5f372a
Коммит 150ee9d360
2 изменённых файлов: 73 добавлений и 7 удалений

Просмотреть файл

@@ -151,3 +151,20 @@ impl Search {
None
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn matches() {
let mut s = Search::default();
s.set_pattern("fo+").unwrap();
let m: Vec<_> = s.matches("fo foo bar fooo").unwrap().collect();
assert_eq!(m, [(0, 2), (3, 6), (11, 15)]);
s.set_pattern("").unwrap();
assert!(s.matches("fo foo bar fooo").is_none());
}
}