test

Attribute Macro test 

Source
#[test]
Expand description

Converts async function to test against a sample runtime.

§Options

  • parallelism: non negative integer to specify parallelism for executor. Defaults to environment variable ASYNCS_TEST_PARALLELISM and 2 in fallback. 0 means available cores.
  • send: whether the async function need to be Send. Defaults to true.

§Examples

use std::future::pending;

#[asyncs::test]
async fn pending_default() {
    let v = select! {
        default => 5,
        i = pending() => i,
    };
    assert_eq!(v, 5);
}