From 4f5dcbf4c2e3f42777fc674923daf3de2a7b68d7 Mon Sep 17 00:00:00 2001 From: YouKnow Date: Wed, 4 Sep 2024 05:14:38 +0330 Subject: [PATCH] fixed the escape test --- crates/teloxide/src/utils/markdown.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/teloxide/src/utils/markdown.rs b/crates/teloxide/src/utils/markdown.rs index 303622fa..36e96beb 100644 --- a/crates/teloxide/src/utils/markdown.rs +++ b/crates/teloxide/src/utils/markdown.rs @@ -4,8 +4,9 @@ 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. /// @@ -247,10 +248,11 @@ mod tests { #[test] fn test_escape() { + assert_eq!(escape("\\!"), r"\\\!"); assert_eq!(escape("* foobar *"), r"\* foobar \*"); assert_eq!( escape(r"_ * [ ] ( ) ~ \ ` > # + - = | { } . !"), - r"\_ \* \[ \] \( \) \~ \ \` \> \# \+ \- \= \| \{ \} \. \!", + r"\_ \* \[ \] \( \) \~ \\ \` \> \# \+ \- \= \| \{ \} \. \!", ); }