()
| 242 | |
| 243 | #[test] |
| 244 | fn it_walks() { |
| 245 | use crate::background::BackgroundHandle; |
| 246 | use crate::config::Config; |
| 247 | |
| 248 | let gs = Config::default().globset().unwrap(); |
| 249 | let scanner = FolderScan::new("C:\\Games", gs); |
| 250 | |
| 251 | let task = BackgroundHandle::spawn(scanner); |
| 252 | |
| 253 | let deadline = Instant::now() + Duration::from_millis(2000); |
| 254 | |
| 255 | loop { |
| 256 | let ret = task.wait_timeout(Duration::from_millis(100)); |
| 257 | |
| 258 | if ret.is_some() { |
| 259 | println!("Scanned: {:?}", ret); |
| 260 | break; |
| 261 | } else { |
| 262 | println!("Status: {:?}", task.status()); |
| 263 | } |
| 264 | |
| 265 | if Instant::now() > deadline { |
| 266 | task.cancel(); |
| 267 | } |
| 268 | } |
| 269 | } |
nothing calls this directly
no test coverage detected