#[command] only after #[derive]

This commit is contained in:
Temirkhan Myrzamadi 2020-06-05 13:12:46 +06:00
parent ae43f1f7ee
commit 594d3e7d19

View file

@ -319,8 +319,8 @@ mod tests {
#[test] #[test]
fn parse_command_with_args() { fn parse_command_with_args() {
#[command(rename = "lowercase")]
#[derive(BotCommand, Debug, PartialEq)] #[derive(BotCommand, Debug, PartialEq)]
#[command(rename = "lowercase")]
enum DefaultCommands { enum DefaultCommands {
Start(String), Start(String),
Help, Help,
@ -334,8 +334,8 @@ mod tests {
#[test] #[test]
fn attribute_prefix() { fn attribute_prefix() {
#[command(rename = "lowercase")]
#[derive(BotCommand, Debug, PartialEq)] #[derive(BotCommand, Debug, PartialEq)]
#[command(rename = "lowercase")]
enum DefaultCommands { enum DefaultCommands {
#[command(prefix = "!")] #[command(prefix = "!")]
Start(String), Start(String),
@ -350,8 +350,8 @@ mod tests {
#[test] #[test]
fn many_attributes() { fn many_attributes() {
#[command(rename = "lowercase")]
#[derive(BotCommand, Debug, PartialEq)] #[derive(BotCommand, Debug, PartialEq)]
#[command(rename = "lowercase")]
enum DefaultCommands { enum DefaultCommands {
#[command(prefix = "!", description = "desc")] #[command(prefix = "!", description = "desc")]
Start, Start,
@ -367,12 +367,12 @@ mod tests {
#[test] #[test]
fn global_attributes() { fn global_attributes() {
#[derive(BotCommand, Debug, PartialEq)]
#[command( #[command(
prefix = "!", prefix = "!",
rename = "lowercase", rename = "lowercase",
description = "Bot commands" description = "Bot commands"
)] )]
#[derive(BotCommand, Debug, PartialEq)]
enum DefaultCommands { enum DefaultCommands {
#[command(prefix = "/")] #[command(prefix = "/")]
Start, Start,
@ -395,8 +395,8 @@ mod tests {
#[test] #[test]
fn parse_command_with_bot_name() { fn parse_command_with_bot_name() {
#[command(rename = "lowercase")]
#[derive(BotCommand, Debug, PartialEq)] #[derive(BotCommand, Debug, PartialEq)]
#[command(rename = "lowercase")]
enum DefaultCommands { enum DefaultCommands {
#[command(prefix = "/")] #[command(prefix = "/")]
Start, Start,
@ -411,9 +411,9 @@ mod tests {
#[test] #[test]
fn parse_with_split() { fn parse_with_split() {
#[derive(BotCommand, Debug, PartialEq)]
#[command(rename = "lowercase")] #[command(rename = "lowercase")]
#[command(parse_with = "split")] #[command(parse_with = "split")]
#[derive(BotCommand, Debug, PartialEq)]
enum DefaultCommands { enum DefaultCommands {
Start(u8, String), Start(u8, String),
Help, Help,
@ -427,9 +427,9 @@ mod tests {
#[test] #[test]
fn parse_with_split2() { fn parse_with_split2() {
#[derive(BotCommand, Debug, PartialEq)]
#[command(rename = "lowercase")] #[command(rename = "lowercase")]
#[command(parse_with = "split", separator = "|")] #[command(parse_with = "split", separator = "|")]
#[derive(BotCommand, Debug, PartialEq)]
enum DefaultCommands { enum DefaultCommands {
Start(u8, String), Start(u8, String),
Help, Help,
@ -460,8 +460,8 @@ mod tests {
) )
} }
#[command(rename = "lowercase")]
#[derive(BotCommand, Debug, PartialEq)] #[derive(BotCommand, Debug, PartialEq)]
#[command(rename = "lowercase")]
enum DefaultCommands { enum DefaultCommands {
#[command(parse_with = "custom_parse_function")] #[command(parse_with = "custom_parse_function")]
Start(u8, String), Start(u8, String),
@ -476,9 +476,9 @@ mod tests {
#[test] #[test]
fn parse_named_fields() { fn parse_named_fields() {
#[derive(BotCommand, Debug, PartialEq)]
#[command(rename = "lowercase")] #[command(rename = "lowercase")]
#[command(parse_with = "split")] #[command(parse_with = "split")]
#[derive(BotCommand, Debug, PartialEq)]
enum DefaultCommands { enum DefaultCommands {
Start { num: u8, data: String }, Start { num: u8, data: String },
Help, Help,