From 2923f1066e92559d8e5f75b5ee0713fc8b1e8305 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Wed, 7 Apr 2021 18:42:18 +0200 Subject: [PATCH] serde: Add test for issue 446 --- ruma-serde/src/time/ms_since_unix_epoch.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ruma-serde/src/time/ms_since_unix_epoch.rs b/ruma-serde/src/time/ms_since_unix_epoch.rs index 42f3bbff..500c4bfb 100644 --- a/ruma-serde/src/time/ms_since_unix_epoch.rs +++ b/ruma-serde/src/time/ms_since_unix_epoch.rs @@ -65,6 +65,17 @@ mod tests { ); } + #[test] + fn issue_446() { + let json = json!({ "timestamp": 15159743990000u64 }); + + assert_matches!( + serde_json::from_value::(json), + Ok(SystemTimeTest { timestamp }) + if timestamp == UNIX_EPOCH + Duration::from_millis(15159743990000) + ); + } + #[test] fn serialize() { let request = SystemTimeTest { timestamp: UNIX_EPOCH + Duration::new(2, 0) };