Add tests for /// Help message

This commit is contained in:
TheAwiteb 2023-03-02 21:08:39 +03:00
parent e3b5572879
commit b91c53588d
No known key found for this signature in database
GPG key ID: ABF818BD15DC2D34

View file

@ -242,6 +242,24 @@ fn descriptions_off() {
assert_eq!(DefaultCommands::descriptions().to_string(), "/help".to_owned()); 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] #[test]
#[cfg(feature = "macros")] #[cfg(feature = "macros")]
fn rename_rules() { fn rename_rules() {