Open xfbs opened 8 months ago
I have added support for specifying functions to execute asynchronous blocks in #[proptes(async = ...)]
. (351a36f9c9de58735417422a187dcbb8f329d4f2)
Using this feature, you can write a test using tokio's single-threaded runtime as follows
use std::future::Future;
use proptest::{prop_assert, test_runner::TestCaseError};
use test_strategy::proptest;
fn tokio_ct(future: impl Future<Output = Result<(), TestCaseError>>) -> Result<(), TestCaseError> {
tokio::runtime::Builder::new_current_thread().build().unwrap().block_on(future)
}
#[proptest(async = tokio_ct)]
async fn async_expr() {
prop_assert!(true);
tokio::task::yield_now().await;
}
Hey! Love this crate. Was wondering if you think it made sense for me to add support for a tokio single-threaded runtime. I think that might be advantageous.