Is your feature request related to a problem? Please describe.
My most common use-case for tokio-test's Spawn is to test futures in a synchronous context. In most cases, I don't care about the outcome to this specific call to poll, but about the outcome of polling the future once it has advanced as far as possible.
I believe that in most testing scenarios, you want something like the following:
let result = loop {
let result = fut.poll();
if result.is_ready() || !fut.is_woken() {
break result;
}
};
Describe the solution you'd like
I would like to add a function Spawn::poll_to_block(&mut self) that has the above logic.
Describe alternatives you've considered
N/A
Additional context
N/A
Is your feature request related to a problem? Please describe.
My most common use-case for tokio-test's
Spawnis to test futures in a synchronous context. In most cases, I don't care about the outcome to this specific call topoll, but about the outcome of polling the future once it has advanced as far as possible.I believe that in most testing scenarios, you want something like the following:
Describe the solution you'd like
I would like to add a function
Spawn::poll_to_block(&mut self)that has the above logic.Describe alternatives you've considered
N/A
Additional context
N/A