From b91c53588d1852e763446324302324454c6d8ede Mon Sep 17 00:00:00 2001 From: TheAwiteb Date: Thu, 2 Mar 2023 21:08:39 +0300 Subject: [PATCH] Add tests for `/// Help message` --- crates/teloxide/tests/command.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/crates/teloxide/tests/command.rs b/crates/teloxide/tests/command.rs index c80e71bc..b10a229d 100644 --- a/crates/teloxide/tests/command.rs +++ b/crates/teloxide/tests/command.rs @@ -242,6 +242,24 @@ fn descriptions_off() { assert_eq!(DefaultCommands::descriptions().to_string(), "/help".to_owned()); } +#[test] +#[cfg(feature = "macros")] +fn description_with_doc_attr() { + #[derive(BotCommands, Debug, PartialEq)] + #[command(rename_rule = "lowercase")] + enum DefaultCommands { + /// Start command + Start, + /// Help command\nwith new line + Help, + } + + assert_eq!( + DefaultCommands::descriptions().to_string(), + "/start — Start command\n/help — Help command\nwith new line" + ); +} + #[test] #[cfg(feature = "macros")] fn rename_rules() {