From cab33bab4ddd2de41ded102cab889bfeb1a1f54b Mon Sep 17 00:00:00 2001 From: theMackabu Date: Tue, 14 Nov 2023 23:57:02 -0800 Subject: [PATCH] update assert --- Cargo.toml | 3 +++ src/lib.rs | 13 ++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 68ffe33..43fc476 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,3 +10,6 @@ description = "Process analysis & watcher daemon" psutil = { version = "3.2.2", features = ["serde"] } serde = "1.0.192" serde_derive = "1.0.192" + +[dev-dependencies] +assert_matches = "1.5.0" \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 8bd63b1..08a4f2e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -87,17 +87,24 @@ impl Paw { #[cfg(test)] mod tests { use super::*; + use assert_matches::assert_matches; #[test] fn watch() { let paw = Paw::new("node", &["tests/test.js"], 500); let callback = move |result: PawResult| { - println!("{:?}", result); + assert_matches!( + result, + PawResult { + info: PawInfo { .. }, + process: PawProcess { .. } + } + ); }; match paw.watch(callback) { - Ok(result) => println!("{:?}", result), - Err(error) => println!("{error}"), + Ok(result) => assert_matches!(result, PawDone { .. }), + Err(error) => panic!("{error}"), } } } -- GitLab