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_user.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_user.rs')
| -rw-r--r-- | tests/test_user.rs | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/tests/test_user.rs b/tests/test_user.rs deleted file mode 100644 index 267b578..0000000 --- a/tests/test_user.rs +++ /dev/null @@ -1,66 +0,0 @@ -extern crate serenity; - -#[cfg(feature = "model")] -mod model { - use serenity::model::id::UserId; - use serenity::model::user::User; - - fn gen() -> User { - User { - id: UserId(210), - avatar: Some("abc".to_string()), - bot: true, - discriminator: 1432, - name: "test".to_string(), - } - } - - #[test] - 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",) - ); - - user.avatar = Some("a_aaa".to_string()); - 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()); - - assert_eq!(user.tag(), "test#1432"); - } - - #[test] - fn default_avatars() { - let mut user = gen(); - - user.discriminator = 0; - assert!(user.default_avatar_url().ends_with("0.png")); - user.discriminator = 1; - assert!(user.default_avatar_url().ends_with("1.png")); - user.discriminator = 2; - assert!(user.default_avatar_url().ends_with("2.png")); - user.discriminator = 3; - assert!(user.default_avatar_url().ends_with("3.png")); - user.discriminator = 4; - assert!(user.default_avatar_url().ends_with("4.png")); - } -} |