Skip to content

Commit 1562614

Browse files
committed
test(runtime): check that runtime does not abort
1 parent 1ff10ed commit 1562614

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

compio-runtime/tests/panic.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,19 @@ fn panic_spawn() {
1414
panic!("another panic");
1515
})
1616
}
17+
18+
#[test]
19+
#[should_panic]
20+
#[cfg_attr(feature = "sanitize", cfg_attr(sanitize = "address", ignore))]
21+
fn simple_drop() {
22+
compio_runtime::Runtime::new().unwrap().block_on(async {
23+
let handle = compio_runtime::spawn(async {
24+
sleep(Duration::from_millis(100)).await;
25+
});
26+
// Register the waker for handle here to make sure that when the task gets
27+
// dropped, `has_waker` check returns true
28+
compio_runtime::spawn(handle).detach();
29+
sleep(Duration::from_millis(100)).await;
30+
panic!("Main future panics");
31+
})
32+
}

0 commit comments

Comments
 (0)