Add a test for pwd_watcher

pull/388/head
Shunsuke Mie 3 years ago committed by Arijit Basu
parent c5f60951f7
commit 05fb583f98

@ -38,3 +38,26 @@ pub fn keep_watching(
});
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
use std::sync::mpsc;
#[test]
fn test_pwd_watcher() {
let (tx_msg_in, rx_msg_in) = mpsc::channel();
let (tx_pwd_watcher, rx_pwd_watcher) = mpsc::channel();
let result = keep_watching("/", tx_msg_in, rx_pwd_watcher);
assert!(result.is_ok());
tx_pwd_watcher.send("/bin".to_string()).unwrap();
let task = rx_msg_in.recv().unwrap();
let msg = MsgIn::External(ExternalMsg::ExplorePwdAsync);
assert_eq!(task, Task::new(msg, None));
}
}

Loading…
Cancel
Save