Skip to main content

elo_rust/stdlib/
string.rs

1//! String manipulation functions
2
3/// String function signatures
4pub const STRING_FUNCTIONS: &[&str] = &[
5    "matches",
6    "contains",
7    "length",
8    "uppercase",
9    "lowercase",
10    "trim",
11    "starts_with",
12    "ends_with",
13];
14
15#[cfg(test)]
16mod tests {
17    use super::*;
18
19    #[test]
20    fn test_string_functions_count() {
21        assert_eq!(STRING_FUNCTIONS.len(), 8);
22    }
23
24    #[test]
25    fn test_matches_function_exists() {
26        assert!(STRING_FUNCTIONS.contains(&"matches"));
27    }
28
29    #[test]
30    fn test_all_string_functions_exist() {
31        assert!(STRING_FUNCTIONS.contains(&"contains"));
32        assert!(STRING_FUNCTIONS.contains(&"length"));
33        assert!(STRING_FUNCTIONS.contains(&"uppercase"));
34    }
35}