futures_test

Attribute Macro test

source
#[test]
Expand description

Enables an async test function. The generated future will be run to completion with futures_executor::block_on.

#[futures_test::test]
async fn my_test() {
    let fut = async { true };
    assert!(fut.await);
}

This is equivalent to the following code:

#[test]
fn my_test() {
    futures::executor::block_on(async move {
        let fut = async { true };
        assert!(fut.await);
    })
}