More than one attribute for the description test

This commit is contained in:
TheAwiteb 2023-08-29 09:13:05 +03:00
parent 0d02c48afd
commit 7304e552cd
No known key found for this signature in database
GPG key ID: ABF818BD15DC2D34

View file

@ -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] #[test]
#[cfg(feature = "macros")] #[cfg(feature = "macros")]
fn rename_rules() { fn rename_rules() {