aboutsummaryrefslogtreecommitdiff
path: root/tests/test_formatters.rs
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2018-08-01 08:08:23 -0700
committerZeyla Hellyer <[email protected]>2018-08-01 08:10:05 -0700
commit3fed313193356c6784a33b79d1c2f583ea3944f9 (patch)
tree875b4bab989fc573850d30317a1797bca5027e9f /tests/test_formatters.rs
parentReword the inner doc comment in `complex_bucket` (diff)
downloadserenity-3fed313193356c6784a33b79d1c2f583ea3944f9.tar.xz
serenity-3fed313193356c6784a33b79d1c2f583ea3944f9.zip
Move unit tests into source
Move the unit tests into the relevant source files. There's no need for them to be seprate, especially when the `tests` directory is meant to be for integration tests. The deserialization tests that include JSON files are still in the `tests` dir, along with the public prelude re-export tests.
Diffstat (limited to 'tests/test_formatters.rs')
-rw-r--r--tests/test_formatters.rs80
1 files changed, 0 insertions, 80 deletions
diff --git a/tests/test_formatters.rs b/tests/test_formatters.rs
deleted file mode 100644
index ccdfba1..0000000
--- a/tests/test_formatters.rs
+++ /dev/null
@@ -1,80 +0,0 @@
-extern crate parking_lot;
-extern crate serenity;
-
-use serenity::model::prelude::*;
-
-#[test]
-fn test_formatters() {
- assert_eq!(ChannelId(1).to_string(), "1");
- assert_eq!(EmojiId(2).to_string(), "2");
- assert_eq!(GuildId(3).to_string(), "3");
- assert_eq!(RoleId(4).to_string(), "4");
- assert_eq!(UserId(5).to_string(), "5");
-}
-
-#[cfg(feature = "utils")]
-#[test]
-fn test_mention() {
- use parking_lot::RwLock;
- use serenity::utils::Colour;
- use std::sync::Arc;
-
- let channel = Channel::Guild(Arc::new(RwLock::new(GuildChannel {
- bitrate: None,
- category_id: None,
- guild_id: GuildId(1),
- kind: ChannelType::Text,
- id: ChannelId(4),
- last_message_id: None,
- last_pin_timestamp: None,
- name: "a".to_string(),
- permission_overwrites: vec![],
- position: 1,
- topic: None,
- user_limit: None,
- nsfw: false,
- })));
- let emoji = Emoji {
- animated: false,
- id: EmojiId(5),
- name: "a".to_string(),
- managed: true,
- require_colons: true,
- roles: vec![],
- };
- let role = Role {
- id: RoleId(2),
- colour: Colour::ROSEWATER,
- hoist: false,
- managed: false,
- mentionable: false,
- name: "fake role".to_string(),
- permissions: Permissions::empty(),
- position: 1,
- };
- let user = User {
- id: UserId(6),
- avatar: None,
- bot: false,
- discriminator: 4132,
- name: "fake".to_string(),
- };
- let member = Member {
- deaf: false,
- guild_id: GuildId(2),
- joined_at: None,
- mute: false,
- nick: None,
- roles: vec![],
- user: Arc::new(RwLock::new(user.clone())),
- };
-
- assert_eq!(ChannelId(1).mention(), "<#1>");
- assert_eq!(channel.mention(), "<#4>");
- assert_eq!(emoji.mention(), "<:a:5>");
- assert_eq!(member.mention(), "<@6>");
- assert_eq!(role.mention(), "<@&2>");
- assert_eq!(role.id.mention(), "<@&2>");
- assert_eq!(user.mention(), "<@6>");
- assert_eq!(user.id.mention(), "<@6>");
-}