summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2017-02-04 00:32:36 +0100
committerLinus Färnstrand <linus@mullvad.net>2017-02-04 01:29:28 +0100
commit8b679519a277c65d449d48c6fa48491b5d158b61 (patch)
tree2fcb082b3e3a7212244660ddbbf67de0911e81fc
parent16b1603abb78563bfde5964b0d19347bd0cc7533 (diff)
downloadmullvadvpn-8b679519a277c65d449d48c6fa48491b5d158b61.tar.xz
mullvadvpn-8b679519a277c65d449d48c6fa48491b5d158b61.zip
Use assert_matches crate to implement assert_event
-rw-r--r--Cargo.toml1
-rw-r--r--src/lib.rs3
-rw-r--r--src/process/monitor.rs5
3 files changed, 5 insertions, 4 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 3f273a71ea..1949c0ba2e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,6 +5,7 @@ authors = ["Linus Färnstrand <linus@mullvad.net>"]
[dependencies]
clonablechild = "0.1"
+assert_matches = "1.0"
[dependencies.talpid_openvpn_plugin]
path = "talpid_openvpn_plugin"
diff --git a/src/lib.rs b/src/lib.rs
index 1b3cf59b66..7a3c2ee659 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,6 +2,9 @@
//! The core components of the talpidaemon VPN client.
+#[macro_use]
+extern crate assert_matches;
+
extern crate clonablechild;
/// Working with processes.
diff --git a/src/process/monitor.rs b/src/process/monitor.rs
index a9d6c0b36b..e8d32a7973 100644
--- a/src/process/monitor.rs
+++ b/src/process/monitor.rs
@@ -247,10 +247,7 @@ mod child_monitor {
macro_rules! assert_event {
($rx:ident, $expected:pat) => {{
let result = $rx.recv_timeout(Duration::new(1, 0));
- if let $expected = result {} else {
- let msg = stringify!($expected);
- panic!("Expected {}. Got {:?}", msg, result);
- }
+ assert_matches!(result, $expected);
}}
}