fixed the escape test

This commit is contained in:
YouKnow 2024-09-04 05:14:38 +03:30
parent 9b3d920819
commit 4f5dcbf4c2

View file

@ -4,8 +4,9 @@
use teloxide_core::types::{User, UserId}; use teloxide_core::types::{User, UserId};
pub(super) const ESCAPE_CHARS: [char; 19] = pub(super) const ESCAPE_CHARS: [char; 19] = [
['\\', '_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!']; '\\', '_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!',
];
/// Applies the bold font style to the string. /// Applies the bold font style to the string.
/// ///
@ -247,10 +248,11 @@ mod tests {
#[test] #[test]
fn test_escape() { fn test_escape() {
assert_eq!(escape("\\!"), r"\\\!");
assert_eq!(escape("* foobar *"), r"\* foobar \*"); assert_eq!(escape("* foobar *"), r"\* foobar \*");
assert_eq!( assert_eq!(
escape(r"_ * [ ] ( ) ~ \ ` > # + - = | { } . !"), escape(r"_ * [ ] ( ) ~ \ ` > # + - = | { } . !"),
r"\_ \* \[ \] \( \) \~ \ \` \> \# \+ \- \= \| \{ \} \. \!", r"\_ \* \[ \] \( \) \~ \\ \` \> \# \+ \- \= \| \{ \} \. \!",
); );
} }