From 7304e552cdb6c80021d51d98866d916525258bcb Mon Sep 17 00:00:00 2001 From: TheAwiteb Date: Tue, 29 Aug 2023 09:13:05 +0300 Subject: [PATCH] More than one attribute for the description test --- crates/teloxide/tests/command.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crates/teloxide/tests/command.rs b/crates/teloxide/tests/command.rs index 330e53a2..60fdc90d 100644 --- a/crates/teloxide/tests/command.rs +++ b/crates/teloxide/tests/command.rs @@ -264,6 +264,30 @@ fn description_with_doc_attr() { ); } +#[test] +#[cfg(feature = "macros")] +fn description_with_doc_attr_and_command() { + #[derive(BotCommands, Debug, PartialEq)] + #[command(rename_rule = "lowercase")] + enum DefaultCommands { + /// Start command + #[command(description = "Start command")] + Start, + #[command(description = "Help command\nwith new line")] + Help, + /// Foo command + /// with new line + #[command(description = "Foo command\nwith new line")] + Foo, + } + + assert_eq!( + DefaultCommands::descriptions().to_string(), + "/start — Start command\nStart command\n/help — Help command\nwith new line\n/foo — Foo command\nwith \ + new line\nFoo command\nwith new line" + ); +} + #[test] #[cfg(feature = "macros")] fn rename_rules() {