testing: provide tick() that can be called anywhere in tests

This commit is contained in:
Greg Johnston 2024-06-09 21:16:04 -04:00
parent 531c39759a
commit 7ecfbd9109

View file

@ -107,6 +107,15 @@ impl Executor {
);
}
}
/// Waits until the next "tick" of the current async executor.
pub async fn tick() {
let (tx, rx) = futures::channel::oneshot::channel();
Executor::spawn(async move {
_ = tx.send(());
});
_ = rx.await;
}
}
impl Executor {