Test the rename attribute

Former-commit-id: 4494acda88
This commit is contained in:
Hirrolot 2022-05-26 23:48:43 +06:00
parent 4993c487ac
commit 74b246a988
2 changed files with 5 additions and 2 deletions

View file

@ -57,7 +57,7 @@ full = [
[dependencies] [dependencies]
teloxide-core = { version = "0.6.0", default-features = false } teloxide-core = { version = "0.6.0", default-features = false }
teloxide-macros = { version = "0.6.1", optional = true } teloxide-macros = { git = "https://github.com/teloxide/teloxide-macros.git", rev = "e344b11dcc0466d1cbbef1139e8cd0646e776188", optional = true }
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View file

@ -218,6 +218,8 @@ fn rename_rules() {
GggGgg, GggGgg,
#[command(rename = "SCREAMING-KEBAB-CASE")] #[command(rename = "SCREAMING-KEBAB-CASE")]
HhhHhh, HhhHhh,
#[command(rename = "Bar")]
Foo,
} }
assert_eq!(DefaultCommands::AaaAaa, DefaultCommands::parse("/aaaaaa", "").unwrap()); assert_eq!(DefaultCommands::AaaAaa, DefaultCommands::parse("/aaaaaa", "").unwrap());
@ -228,9 +230,10 @@ fn rename_rules() {
assert_eq!(DefaultCommands::FffFff, DefaultCommands::parse("/FFF_FFF", "").unwrap()); assert_eq!(DefaultCommands::FffFff, DefaultCommands::parse("/FFF_FFF", "").unwrap());
assert_eq!(DefaultCommands::GggGgg, DefaultCommands::parse("/ggg-ggg", "").unwrap()); assert_eq!(DefaultCommands::GggGgg, DefaultCommands::parse("/ggg-ggg", "").unwrap());
assert_eq!(DefaultCommands::HhhHhh, DefaultCommands::parse("/HHH-HHH", "").unwrap()); assert_eq!(DefaultCommands::HhhHhh, DefaultCommands::parse("/HHH-HHH", "").unwrap());
assert_eq!(DefaultCommands::Foo, DefaultCommands::parse("/Bar", "").unwrap());
assert_eq!( assert_eq!(
"/aaaaaa\n/BBBBBB\n/CccCcc\n/dddDdd\n/eee_eee\n/FFF_FFF\n/ggg-ggg\n/HHH-HHH", "/aaaaaa\n/BBBBBB\n/CccCcc\n/dddDdd\n/eee_eee\n/FFF_FFF\n/ggg-ggg\n/HHH-HHH\n/Bar",
DefaultCommands::descriptions().to_string() DefaultCommands::descriptions().to_string()
); );
} }