More tests

This commit is contained in:
Roman Proskuryakov 2023-09-15 17:10:54 +03:00
parent 835f31be80
commit e73ed1bd0e

View file

@ -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() {