safina-async-test

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

An async_test macro for running async fn tests.

It is part of safina, a safe async runtime.

Features

Limitations

Examples

```rust use safinaasynctest::async_test;

[async_test]

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

```rust use safina; use safinaasynctest::async_test;

// Make your test an async fn.

[async_test]

async fn test2() { // You can await. async_work().await.unwrap();

// You can spawn tasks which will run on
// the executor.
// These tasks stop when the test
// function returns and drops the
// executor.
safina::spawn(background_task());

// You can run blocking code without
// stalling other async tasks.
let result = safina::schedule_blocking(
    || blocking_work()
);
assert_eq!(3, result.await.unwrap());

// You can use timer functions.
safina::sleep_for(
    Duration::from_millis(10)).await;
safina::with_timeout(
    async_work(),
    Duration::from_millis(100)
).await.unwrap();

} ```

Documentation

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

Alternatives

Changelog

Happy Contributors 🙂

Fixing bugs and adding features is easy and fast. Send us a pull request and we intend to: - Always respond within 24 hours - Provide clear & concrete feedback - Immediately make a new release for your accepted change

TO DO

Release Process

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

License: Apache-2.0