# safina-async-test

A macro for running `async fn` tests.

Runs tests with [`safina::block_on`](https://docs.rs/safina/latest/safina/fn.block_on.html).

Related crates:
- [`safina`](https://crates.io/crates/safina) - safe async runtime
- [`safina-timer`](https://crates.io/crates/safina-timer) - safe async sleep functions
- [`safina-async-test`](https://crates.io/crates/safina-async-test) - macro for running async tests

## Limitations
- Requires Rust `nightly` because safina does

## Examples
```rust
#[async_test]
async fn test1() {
    an_async_fn().await.unwrap();
}
```

```rust
#[async_test]
async fn test2() {
    safina::increase_threads_to(1);
    safina::spawn(Box::pin(background_task()));
    assert_eq!(42, do_request().await.unwrap());
}
```

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

## Alternatives
- [`async_std::test`](https://docs.rs/async-std/latest/async_std/attr.test.html)
- [`futures_await_test::async_test`](https://docs.rs/futures-await-test/0.3.0/futures_await_test/)
- [`tokio::test`](https://docs.rs/tokio/latest/tokio/attr.test.html)

## Release Process
1. Edit `Cargo.toml` and bump version number.
1. Run `./release.sh`

## Changelog
- v0.1.1 - First published version

## TO DO
- DONE - Implement as declarative macro.  UX is bad.
- DONE - Implement as procedural macro.
- DONE - Report errors nicely
- DONE - Drop finished futures
- Publish on crates.io

License: Apache-2.0
