diff options
| author | acdenisSK <[email protected]> | 2017-07-27 06:42:48 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-07-27 07:30:23 +0200 |
| commit | 550030264952f0e0043b63f4582bb817ef8bbf37 (patch) | |
| tree | b921e2f78fd603a5ca671623083a32806fd16090 /tests | |
| parent | Use a consistent indentation style (diff) | |
| download | serenity-550030264952f0e0043b63f4582bb817ef8bbf37.tar.xz serenity-550030264952f0e0043b63f4582bb817ef8bbf37.zip | |
rustfmt
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_channels.rs | 24 | ||||
| -rw-r--r-- | tests/test_colour.rs | 2 | ||||
| -rw-r--r-- | tests/test_create_embed.rs | 15 | ||||
| -rw-r--r-- | tests/test_formatters.rs | 28 | ||||
| -rw-r--r-- | tests/test_message.rs | 3 | ||||
| -rw-r--r-- | tests/test_msg_builder.rs | 20 | ||||
| -rw-r--r-- | tests/test_parsers.rs | 26 | ||||
| -rw-r--r-- | tests/test_prelude.rs | 2 | ||||
| -rw-r--r-- | tests/test_user.rs | 18 |
9 files changed, 73 insertions, 65 deletions
diff --git a/tests/test_channels.rs b/tests/test_channels.rs index a4fc443..cdce00f 100644 --- a/tests/test_channels.rs +++ b/tests/test_channels.rs @@ -1,6 +1,6 @@ extern crate serenity; -#[cfg(feature="utils")] +#[cfg(feature = "utils")] mod utils { use serenity::model::*; use std::collections::HashMap; @@ -31,7 +31,7 @@ mod utils { position: 0, topic: None, user_limit: None, - nsfw: false, + nsfw: false, } } @@ -42,12 +42,12 @@ mod utils { last_pin_timestamp: None, kind: ChannelType::Private, recipient: Arc::new(RwLock::new(User { - id: UserId(2), - avatar: None, - bot: false, - discriminator: 1, - name: "ab".to_owned(), - })), + id: UserId(2), + avatar: None, + bot: false, + discriminator: 1, + name: "ab".to_owned(), + })), } } @@ -69,11 +69,11 @@ mod utils { channel.kind = ChannelType::Text; channel.name = "nsf".to_owned(); - channel.nsfw = true; + channel.nsfw = true; assert!(channel.is_nsfw()); - channel.nsfw = false; - assert!(!channel.is_nsfw()); - + channel.nsfw = false; + assert!(!channel.is_nsfw()); + let channel = Channel::Guild(Arc::new(RwLock::new(channel))); assert!(!channel.is_nsfw()); diff --git a/tests/test_colour.rs b/tests/test_colour.rs index 4cd11c0..61aa034 100644 --- a/tests/test_colour.rs +++ b/tests/test_colour.rs @@ -1,4 +1,4 @@ -#![cfg(feature="utils")] +#![cfg(feature = "utils")] extern crate serenity; diff --git a/tests/test_create_embed.rs b/tests/test_create_embed.rs index 527d3e8..5e15c63 100644 --- a/tests/test_create_embed.rs +++ b/tests/test_create_embed.rs @@ -1,6 +1,7 @@ -#![cfg(feature="utils")] +#![cfg(feature = "utils")] -#[macro_use] extern crate serde_json; +#[macro_use] +extern crate serde_json; extern crate serenity; use serde_json::Value; @@ -28,11 +29,11 @@ fn test_from_embed() { ], footer: None, image: Some(EmbedImage { - height: 213, - proxy_url: "a".to_owned(), - url: "https://i.imgur.com/XfWpfCV.gif".to_owned(), - width: 224, - }), + height: 213, + proxy_url: "a".to_owned(), + url: "https://i.imgur.com/XfWpfCV.gif".to_owned(), + width: 224, + }), kind: "rich".to_owned(), provider: None, thumbnail: None, diff --git a/tests/test_formatters.rs b/tests/test_formatters.rs index a651e60..c08d044 100644 --- a/tests/test_formatters.rs +++ b/tests/test_formatters.rs @@ -11,26 +11,26 @@ fn test_formatters() { assert_eq!(UserId(5).to_string(), "5"); } -#[cfg(feature="utils")] +#[cfg(feature = "utils")] #[test] fn test_mention() { use serenity::utils::Colour; use std::sync::{Arc, RwLock}; let channel = Channel::Guild(Arc::new(RwLock::new(GuildChannel { - bitrate: None, - guild_id: GuildId(1), - kind: ChannelType::Text, - id: ChannelId(4), - last_message_id: None, - last_pin_timestamp: None, - name: "a".to_owned(), - permission_overwrites: vec![], - position: 1, - topic: None, - user_limit: None, - nsfw: false, - }))); + bitrate: None, + guild_id: GuildId(1), + kind: ChannelType::Text, + id: ChannelId(4), + last_message_id: None, + last_pin_timestamp: None, + name: "a".to_owned(), + permission_overwrites: vec![], + position: 1, + topic: None, + user_limit: None, + nsfw: false, + }))); let emoji = Emoji { id: EmojiId(5), name: "a".to_owned(), diff --git a/tests/test_message.rs b/tests/test_message.rs index 4ca4c3e..5f4140d 100644 --- a/tests/test_message.rs +++ b/tests/test_message.rs @@ -20,7 +20,8 @@ macro_rules! p { fn test_footer_deser() { let mut message = p!(Message, "message_footer_1"); - assert_eq!(message.embeds.remove(0).footer.unwrap().text, "2005-09-26 - 2013-09-26"); + assert_eq!(message.embeds.remove(0).footer.unwrap().text, + "2005-09-26 - 2013-09-26"); p!(Message, "message_footer_2"); } diff --git a/tests/test_msg_builder.rs b/tests/test_msg_builder.rs index 56767b8..1acb673 100644 --- a/tests/test_msg_builder.rs +++ b/tests/test_msg_builder.rs @@ -1,4 +1,4 @@ -#![cfg(feature="utils")] +#![cfg(feature = "utils")] extern crate serenity; @@ -26,9 +26,7 @@ fn safe_content() { #[test] fn no_free_formatting() { - let content = MessageBuilder::new() - .push_bold_safe("test**test") - .build(); + let content = MessageBuilder::new().push_bold_safe("test**test").build(); assert_ne!(content, "**test**test**"); } @@ -36,12 +34,12 @@ fn no_free_formatting() { fn mentions() { let content_emoji = MessageBuilder::new() .emoji(Emoji { - id: EmojiId(32), - name: "Rohrkatze".to_string(), - managed: false, - require_colons: true, - roles: vec![] - }) + id: EmojiId(32), + name: "Rohrkatze".to_string(), + managed: false, + require_colons: true, + roles: vec![], + }) .build(); let content_mentions = MessageBuilder::new() .channel(1) @@ -66,7 +64,7 @@ fn message_content() { .push(Bold + Italic + Code + "Fun!") .build(); - assert_eq!(message_content, "***`Fun!`***"); + assert_eq!(message_content, "***`Fun!`***"); } #[test] diff --git a/tests/test_parsers.rs b/tests/test_parsers.rs index 7823ccb..e9d3d39 100644 --- a/tests/test_parsers.rs +++ b/tests/test_parsers.rs @@ -1,4 +1,4 @@ -#![cfg(feature="utils")] +#![cfg(feature = "utils")] extern crate serenity; @@ -6,36 +6,36 @@ use serenity::utils::*; #[test] fn invite_parser() { - assert_eq!(parse_invite("https://discord.gg/abc"), "abc"); - assert_eq!(parse_invite("http://discord.gg/abc"), "abc"); - assert_eq!(parse_invite("discord.gg/abc"), "abc"); + assert_eq!(parse_invite("https://discord.gg/abc"), "abc"); + assert_eq!(parse_invite("http://discord.gg/abc"), "abc"); + assert_eq!(parse_invite("discord.gg/abc"), "abc"); } #[test] fn username_parser() { - assert_eq!(parse_username("<@12345>").unwrap(), 12345); - assert_eq!(parse_username("<@!12345>").unwrap(), 12345); + assert_eq!(parse_username("<@12345>").unwrap(), 12345); + assert_eq!(parse_username("<@!12345>").unwrap(), 12345); } #[test] fn role_parser() { - assert_eq!(parse_role("<@&12345>").unwrap(), 12345); + assert_eq!(parse_role("<@&12345>").unwrap(), 12345); } #[test] fn channel_parser() { - assert_eq!(parse_channel("<#12345>").unwrap(), 12345); + assert_eq!(parse_channel("<#12345>").unwrap(), 12345); } #[test] fn emoji_parser() { - let emoji = parse_emoji("<:name:12345>").unwrap(); - assert_eq!(emoji.name, "name"); - assert_eq!(emoji.id, 12345); + let emoji = parse_emoji("<:name:12345>").unwrap(); + assert_eq!(emoji.name, "name"); + assert_eq!(emoji.id, 12345); } #[test] fn quote_parser() { - let parsed = parse_quotes("a \"b c\" d\"e f\" g"); - assert_eq!(parsed, ["a", "b c", "d", "e f", "g"]); + let parsed = parse_quotes("a \"b c\" d\"e f\" g"); + assert_eq!(parsed, ["a", "b c", "d", "e f", "g"]); } diff --git a/tests/test_prelude.rs b/tests/test_prelude.rs index c62e526..2317fc0 100644 --- a/tests/test_prelude.rs +++ b/tests/test_prelude.rs @@ -4,5 +4,5 @@ extern crate serenity; use serenity::prelude::{Mentionable, SerenityError}; #[allow(unused_imports)] -#[cfg(feature="client")] +#[cfg(feature = "client")] use serenity::prelude::{Client, ClientError}; diff --git a/tests/test_user.rs b/tests/test_user.rs index d037dc2..51f32e1 100644 --- a/tests/test_user.rs +++ b/tests/test_user.rs @@ -1,6 +1,6 @@ extern crate serenity; -#[cfg(feature="model")] +#[cfg(feature = "model")] mod model { use serenity::model::{User, UserId}; @@ -18,12 +18,20 @@ mod model { fn test_core() { let mut user = gen(); - assert!(user.avatar_url().unwrap().ends_with("/avatars/210/abc.webp?size=1024")); - assert!(user.static_avatar_url().unwrap().ends_with("/avatars/210/abc.webp?size=1024")); + assert!(user.avatar_url() + .unwrap() + .ends_with("/avatars/210/abc.webp?size=1024")); + assert!(user.static_avatar_url() + .unwrap() + .ends_with("/avatars/210/abc.webp?size=1024")); user.avatar = Some("a_aaa".to_owned()); - assert!(user.avatar_url().unwrap().ends_with("/avatars/210/a_aaa.gif?size=1024")); - assert!(user.static_avatar_url().unwrap().ends_with("/avatars/210/a_aaa.webp?size=1024")); + assert!(user.avatar_url() + .unwrap() + .ends_with("/avatars/210/a_aaa.gif?size=1024")); + assert!(user.static_avatar_url() + .unwrap() + .ends_with("/avatars/210/a_aaa.webp?size=1024")); user.avatar = None; assert!(user.avatar_url().is_none()); |