Crate tokio_test

Source
Expand description

Tokio and Futures based testing utilities

Modules§

io
A mock type implementing AsyncRead and AsyncWrite.
stream_mock
A mock stream implementing Stream.
task
Futures task based helpers to easily test futures and manually written futures.

Macros§

assert_elapsed
Asserts that an exact duration has elapsed since the start instant ±1ms.
assert_err
Asserts that the expression evaluates to Err and returns the error.
assert_ok
Asserts that the expression evaluates to Ok and returns the value.
assert_pending
Asserts a Poll is pending.
assert_ready
Asserts a Poll is ready, returning the value.
assert_ready_eq
Asserts if a poll is ready and check for equality on the value
assert_ready_err
Asserts a Poll<Result<...>> is ready and Err, returning the error.
assert_ready_ok
Asserts a Poll<Result<...>> is ready and Ok, returning the value.

Functions§

block_on
Runs the provided future, blocking the current thread until the future completes.