File: panic_prop.rs

package info (click to toggle)
rust-async-executor 1.13.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 252 kB
  • sloc: makefile: 2; sh: 1
file content (14 lines) | stat: -rw-r--r-- 385 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use async_executor::Executor;
use futures_lite::{future, prelude::*};

#[test]
fn test_panic_propagation() {
    let ex = Executor::new();
    let task = ex.spawn(async { panic!("should be caught by the task") });

    // Running the executor should not panic.
    assert!(ex.try_tick());

    // Polling the task should.
    assert!(future::block_on(task.catch_unwind()).is_err());
}