Skip to main content

use_text/
lib.rs

1#![forbid(unsafe_code)]
2#![doc = include_str!("../README.md")]
3
4pub use use_case;
5pub use use_markdown;
6pub use use_slug;
7pub use use_text_line;
8pub use use_token;
9pub use use_word;
10
11pub mod prelude;
12
13#[cfg(test)]
14mod tests {
15    use super::prelude::{
16        LineEnding, extract_headings, heading_to_anchor, slugify, to_snake_case, token_count,
17        word_count,
18    };
19
20    #[test]
21    fn facade_exposes_focused_crates() {
22        assert_eq!(to_snake_case("HelloWorld"), "hello_world");
23        assert_eq!(extract_headings("# Hello")[0].text, "Hello");
24        assert_eq!(heading_to_anchor("Hello World"), "hello-world");
25        assert_eq!(slugify("Hello World"), "hello-world");
26        assert_eq!(token_count("Hello world"), 2);
27        assert_eq!(word_count("Hello world"), 2);
28        assert_eq!(LineEnding::Lf.as_str(), "\n");
29    }
30}