aboutsummaryrefslogtreecommitdiff
path: root/tests/test_deser.rs
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-06-10 21:55:33 -0700
committerZeyla Hellyer <[email protected]>2017-06-10 21:55:33 -0700
commitd0b64cd64a18a6116267fa09a837d62c19cced42 (patch)
treefc68a0891ea0ddd8187c38f289c8a9ccddc07e8c /tests/test_deser.rs
parentFix voice compilation (diff)
downloadserenity-d0b64cd64a18a6116267fa09a837d62c19cced42.tar.xz
serenity-d0b64cd64a18a6116267fa09a837d62c19cced42.zip
Fix negative nonces failing to deserialize
Negative message nonces caused deserialization errors, as serde would not deserialize integers into strings. To fix this, change `Message::nonce` into an `Option<Snowflake>` from an `Option<String>`. This new `Snowflake` is a wrapper around an `i64`. Use a new `I64Visitor` to deserialize i64s, u64s, and strs into the wanted i64.
Diffstat (limited to 'tests/test_deser.rs')
-rw-r--r--tests/test_deser.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/test_deser.rs b/tests/test_deser.rs
index f4387bc..1024492 100644
--- a/tests/test_deser.rs
+++ b/tests/test_deser.rs
@@ -111,7 +111,11 @@ fn guild_update() {
#[test]
fn message_create() {
+ // standard
p!(MessageCreateEvent, "message_create_1");
+
+ // negative nonce
+ p!(MessageCreateEvent, "message_create_2");
}
#[test]