serde: Add test for issue 446

This commit is contained in:
Jonas Platte 2021-04-07 18:42:18 +02:00
parent 5de8d3be5d
commit 2923f1066e
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -65,6 +65,17 @@ mod tests {
);
}
#[test]
fn issue_446() {
let json = json!({ "timestamp": 15159743990000u64 });
assert_matches!(
serde_json::from_value::<SystemTimeTest>(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) };