diff options
| author | Zeyla Hellyer <[email protected]> | 2018-08-01 08:08:23 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2018-08-01 08:10:05 -0700 |
| commit | 3fed313193356c6784a33b79d1c2f583ea3944f9 (patch) | |
| tree | 875b4bab989fc573850d30317a1797bca5027e9f /tests/test_msg_builder.rs | |
| parent | Reword the inner doc comment in `complex_bucket` (diff) | |
| download | serenity-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_msg_builder.rs')
| -rw-r--r-- | tests/test_msg_builder.rs | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/tests/test_msg_builder.rs b/tests/test_msg_builder.rs deleted file mode 100644 index c291bf5..0000000 --- a/tests/test_msg_builder.rs +++ /dev/null @@ -1,77 +0,0 @@ -#![cfg(feature = "utils")] - -extern crate serenity; - -use serenity::utils::MessageBuilder; -use serenity::utils::ContentModifier::*; -use serenity::model::guild::Emoji; -use serenity::model::id::{EmojiId, UserId}; - -#[test] -fn code_blocks() { - let content = MessageBuilder::new() - .push_codeblock("test", Some("rb")) - .build(); - assert_eq!(content, "```rb\ntest\n```"); -} - -#[test] -fn safe_content() { - let content = MessageBuilder::new() - .push_safe("@everyone discord.gg/discord-api") - .build(); - assert_ne!(content, "@everyone discord.gg/discord-api"); -} - -#[test] -fn no_free_formatting() { - let content = MessageBuilder::new().push_bold_safe("test**test").build(); - assert_ne!(content, "**test**test**"); -} - -#[test] -fn mentions() { - let content_emoji = MessageBuilder::new() - .emoji(&Emoji { - animated: false, - id: EmojiId(32), - name: "Rohrkatze".to_string(), - managed: false, - require_colons: true, - roles: vec![], - }) - .build(); - let content_mentions = MessageBuilder::new() - .channel(1) - .mention(&UserId(2)) - .role(3) - .user(4) - .build(); - assert_eq!(content_mentions, "<#1><@2><@&3><@4>"); - assert_eq!(content_emoji, "<:Rohrkatze:32>"); -} - -#[test] -fn content() { - let content = Bold + Italic + Code + "Fun!"; - - assert_eq!(content.to_string(), "***`Fun!`***"); -} - -#[test] -fn message_content() { - let message_content = MessageBuilder::new() - .push(Bold + Italic + Code + "Fun!") - .build(); - - assert_eq!(message_content, "***`Fun!`***"); -} - -#[test] -fn message_content_safe() { - let message_content = MessageBuilder::new() - .push_safe(Bold + Italic + "test**test") - .build(); - - assert_eq!(message_content, "***test\\*\\*test***"); -} |