[][src]Macro tokio_test::assert_ready_ok

macro_rules! assert_ready_ok {
    ($e:expr) => { ... };
    ($e:expr, $($msg:tt)+) => { ... };
}

Assert a Poll<Result<...>> is ready and Ok, returning the value.

This will invoke panic! if the provided Poll does not evaluate to Poll::Ready(Ok(..)) at runtime.

Custom Messages

This macro has a second form, where a custom panic message can be provided with or without arguments for formatting.

Examples

use std::future::Future;
use futures_util::{future, pin_mut};
use tokio_test::{assert_ready_ok, task};

task::mock(|cx| {
    let fut = future::ok::<_, ()>(());

    pin_mut!(fut);
    assert_ready_ok!(fut.poll(cx));
})