Macro tokio_test::assert_ready_ok
source · macro_rules! assert_ready_ok { ($e:expr) => { ... }; ($e:expr, $($msg:tt)+) => { ... }; }
Expand description
Asserts 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 futures_util::future;
use tokio_test::{assert_ready_ok, task};
let mut fut = task::spawn(future::ok::<_, ()>(()));
assert_ready_ok!(fut.poll());