diff --git a/Cargo.toml b/Cargo.toml index 68ffe3381e811337a435b5ee079e010b0810fbad..43fc476d7f891e6c4241d2ffeffa52ac412a5eee 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 8bd63b1c3077075ccf9c51de46c3095d44f4e32b..08a4f2e622c120175a503df44109d51faf5dde73 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}"), } } }