safina-async-test

crates.io version license: Apache 2.0 unsafe forbidden pipeline status

A macro for running async fn tests.

It is part of safina, a safe async runtime.

Runs tests with safina_executor::block_on.

Features

Limitations

Examples

```rust use safinaasynctest::async_test;

[async_test]

async fn test1() { anasyncfn().await.unwrap(); } ```

```rust use safinaasynctest::async_test;

[async_test]

async fn test2() { // Make your test an async fn and await in it. asserteq!(42, dorequest().await.unwrap());

// The macro creates an Executor and runs the test through it.
// You can spawn async tasks on it:
safina_executor::spawn(background_task());

// You can schedule blocking jobs to run on the Executor:
let result = safina_executor::schedule_blocking(|| blocking_work());
assert_eq!(3, result.await.unwrap());

// The macro also starts the timer thread, so this works:
safina_timer::sleep_for(Duration::from_millis(10)).await;

} ```

Documentation

https://docs.rs/safina-async-test

Alternatives

Changelog

TO DO

Release Process

  1. Edit Cargo.toml and bump version number.
  2. Run ./release.sh

License: Apache-2.0