MCPcopy Create free account
hub / github.com/Freaky/Compactor / it_cancels

Function it_cancels

src/background.rs:213–230  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

211
212 #[test]
213 fn it_cancels() {
214 let task = Tick;
215
216 let handle = BackgroundHandle::spawn(task);
217
218 for _ in 0..10 {
219 thread::sleep(Duration::from_millis(10));
220 let got = handle.poll();
221 assert!(got.is_none());
222 }
223
224 handle.cancel();
225
226 let ret = handle.wait();
227 assert!(ret.is_err());
228 let ticks = ret.unwrap_err();
229 assert!(9 <= ticks && ticks <= 12);
230 }
231
232 #[test]
233 fn it_pauses() {

Callers

nothing calls this directly

Calls 3

pollMethod · 0.80
cancelMethod · 0.80
waitMethod · 0.80

Tested by

no test coverage detected