[][src]Macro tokio_test::assert_pending

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

Assert a Poll is pending.

This will invoke panic! if the provided Poll does not evaluate to Poll::Pending 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 std::task::Poll;
use futures_util::{future, pin_mut};
use tokio_test::{assert_pending, task};

task::mock(|cx| {
    let fut = future::pending::<()>();

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