diff options
| author | Skye <[email protected]> | 2017-05-31 04:30:03 +0100 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-05-30 20:30:03 -0700 |
| commit | 060b06ec62b1f4e4cc2c11b877fd988b7dcfe627 (patch) | |
| tree | c7ecaa61abfae69093a13920f53867f078a64928 /tests/test_msg_builder.rs | |
| parent | Don't create group in help if no commands to show (diff) | |
| download | serenity-060b06ec62b1f4e4cc2c11b877fd988b7dcfe627.tar.xz serenity-060b06ec62b1f4e4cc2c11b877fd988b7dcfe627.zip | |
Add Content for MessageBuilder
Allow `push` and `push_safe` to use a flexible syntax for formatting.
Diffstat (limited to 'tests/test_msg_builder.rs')
| -rw-r--r-- | tests/test_msg_builder.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_msg_builder.rs b/tests/test_msg_builder.rs index 10c4d51..8cead22 100644 --- a/tests/test_msg_builder.rs +++ b/tests/test_msg_builder.rs @@ -1,6 +1,7 @@ extern crate serenity; use serenity::utils::MessageBuilder; +use serenity::utils::ContentModifier::*; use serenity::model::Emoji; use serenity::model::EmojiId; use serenity::model::UserId; @@ -51,3 +52,28 @@ fn mentions() { 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***"); +} |