From 0384035c485860a81f418044af8f14f914b4c6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sat, 11 Jun 2022 22:35:52 +0200 Subject: [PATCH] events: Make some test assertions more helpful --- crates/ruma-common/src/events/policy/rule/room.rs | 5 +---- crates/ruma-common/src/events/push_rules.rs | 2 +- crates/ruma-common/src/events/room/encrypted.rs | 6 +++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/crates/ruma-common/src/events/policy/rule/room.rs b/crates/ruma-common/src/events/policy/rule/room.rs index 0150b8d5..8150b874 100644 --- a/crates/ruma-common/src/events/policy/rule/room.rs +++ b/crates/ruma-common/src/events/policy/rule/room.rs @@ -87,9 +87,6 @@ mod tests { } }); - assert!(from_json_value::>(json) - .unwrap() - .deserialize() - .is_ok()); + from_json_value::>(json).unwrap().deserialize().unwrap(); } } diff --git a/crates/ruma-common/src/events/push_rules.rs b/crates/ruma-common/src/events/push_rules.rs index eaace8e9..ad667d44 100644 --- a/crates/ruma-common/src/events/push_rules.rs +++ b/crates/ruma-common/src/events/push_rules.rs @@ -235,6 +235,6 @@ mod tests { "type": "m.push_rules" }); - assert!(from_json_value::(json_data).is_ok()); + from_json_value::(json_data).unwrap(); } } diff --git a/crates/ruma-common/src/events/room/encrypted.rs b/crates/ruma-common/src/events/room/encrypted.rs index bedf3edf..16cc0f36 100644 --- a/crates/ruma-common/src/events/room/encrypted.rs +++ b/crates/ruma-common/src/events/room/encrypted.rs @@ -411,11 +411,11 @@ mod tests { #[test] fn deserialization_failure() { - assert!(from_json_value::>( - json!({ "algorithm": "m.megolm.v1.aes-sha2" }) + from_json_value::>( + json!({ "algorithm": "m.megolm.v1.aes-sha2" }), ) .unwrap() .deserialize() - .is_err()); + .unwrap_err(); } }