From e73ed1bd0eaea28ce20eeff252bb4fde070da2e8 Mon Sep 17 00:00:00 2001 From: Roman Proskuryakov Date: Fri, 15 Sep 2023 17:10:54 +0300 Subject: [PATCH] More tests --- crates/teloxide/tests/command.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/crates/teloxide/tests/command.rs b/crates/teloxide/tests/command.rs index 4ddbd8ba..ce6ccf75 100644 --- a/crates/teloxide/tests/command.rs +++ b/crates/teloxide/tests/command.rs @@ -200,6 +200,33 @@ fn parse_with_command_separator2() { ); } +#[test] +#[cfg(feature = "macros")] +fn parse_with_command_separator3() { + #[derive(BotCommands, Debug, PartialEq)] + #[command(rename_rule = "lowercase")] + #[command(parse_with = "split", command_separator = ":")] + enum DefaultCommands { + Help, + } + + assert_eq!(DefaultCommands::Help, DefaultCommands::parse("/help", "").unwrap()); +} + +#[test] +#[cfg(feature = "macros")] +fn parse_with_command_separator4() { + #[derive(BotCommands, Debug, PartialEq)] + #[command(rename_rule = "lowercase")] + #[command(parse_with = "split", command_separator = ":")] + enum DefaultCommands { + Start(u8), + Help, + } + + assert_eq!(DefaultCommands::Start(10), DefaultCommands::parse("/start:10", "").unwrap()); +} + #[test] #[cfg(feature = "macros")] fn parse_custom_parser() {