It seems one cannot use #[tokio-test]
for test async functions in the Rust doc test?
For now I have to write an async main function and tag it with #[tokio-main]
and call test_fn().await
in it to let some async function run during cargo test --doc
.
Is there some other better ways to allow doc tests run as if it is a normal test function, for example with #[tokio-test]
? Also it would be nice if the tag #[tokio-test]
can be shown in the doc, so users can copy the doc and use it as a test directly in their project. (And this probably can be done like ##[tokio-test]
?)