mirror of
https://github.com/sayanarijit/xplr
synced 2024-11-04 18:00:14 +00:00
Add a test for pwd_watcher
This commit is contained in:
parent
c5f60951f7
commit
05fb583f98
@ -38,3 +38,26 @@ pub fn keep_watching(
|
|||||||
});
|
});
|
||||||
Ok(())
|
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…
Reference in New Issue
Block a user