Add tests to be sure that SystemExt::refresh_process adds the process if it isn't listed yet
extern crate sysinfo;
-#[test]
-fn test_process() {
#[cfg(not(windows))]
use sysinfo::ProcessExt;
use sysinfo::SystemExt;
+#[test]
+fn test_process() {
let mut s = sysinfo::System::new();
assert_eq!(s.get_processes().len(), 0);
s.refresh_processes();
@@ -22,3 +22,11 @@ fn test_process() {
.values()
.any(|p| p.exe().to_str().unwrap_or_else(|| "").len() != 0));
}
+
+#[test]
+fn test_process_refresh() {
+ let mut s = sysinfo::System::new();
+ assert_eq!(s.get_processes().len(), 0);
+ s.refresh_process(sysinfo::get_current_pid().expect("failed to get current pid"));
+ assert_eq!(s.get_process(sysinfo::get_current_pid().expect("failed to get current pid")).is_some(), true);
+}
