Open ThatGeoGuy opened 7 months ago
I would accept a PR for this.
I submitted #6 to test this issue. However, it looks like tests that return Result
already work?
#[apply(test!)]
async fn it_works(_ex: &Executor<'_>) -> Result<(), Box<dyn std::error::Error>> {
let _ = u32::try_from(20usize)?;
Ok(())
}
First off: thanks for the crate, it makes getting started writing tests pretty easy to work with.
In regular (standard, not async) Rust we can do:
However, the
test!
macro doesn't support this form at all, and assumes that all tests return()
.This means that we can't write:
The current workaround to this is to just
.unwrap
or.expect
allResult
types in the function. Materially, they don't really change the logic of the test (since a panic means failure), but it is often nice to be able to write the code with?
andFromResidual
only because the tests can often serve as an example for how code should be written in practice.Thoughts? Would the current macro be able to be reworked so that the return type for a test can be set as well?