mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-27 00:00:12 +02:00
chore: enable full CI run (#1399)
* update all tests * fix doc examples * misc API tweaks
This commit is contained in:
+13
-8
@@ -2,21 +2,26 @@
|
||||
//!
|
||||
//! # Example
|
||||
//!
|
||||
//! ```ignore
|
||||
//! use tokio_test::clock;
|
||||
//! use tokio_test::{assert_ready, assert_not_ready};
|
||||
//! ```
|
||||
//! #![feature(async_await)]
|
||||
//!
|
||||
//! use tokio::clock;
|
||||
//! use tokio_test::{assert_ready, assert_pending, task};
|
||||
//! use tokio_timer::Delay;
|
||||
//!
|
||||
//! use std::time::Duration;
|
||||
//! use futures::Future;
|
||||
//!
|
||||
//! clock::mock(|handle| {
|
||||
//! let mut delay = Delay::new(handle.now() + Duration::from_secs(1));
|
||||
//! tokio_test::clock::mock(|handle| {
|
||||
//! let mut task = task::spawn(async {
|
||||
//! let delay = Delay::new(clock::now() + Duration::from_secs(1));
|
||||
//! delay.await
|
||||
//! });
|
||||
//!
|
||||
//! assert_not_ready!(delay.poll());
|
||||
//! assert_pending!(task.poll());
|
||||
//!
|
||||
//! handle.advance(Duration::from_secs(1));
|
||||
//!
|
||||
//! assert_ready!(delay.poll());
|
||||
//! assert_ready!(task.poll());
|
||||
//! });
|
||||
//! ```
|
||||
|
||||
|
||||
@@ -9,16 +9,6 @@
|
||||
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
|
||||
|
||||
//! Tokio and Futures based testing utilites
|
||||
//!
|
||||
//! # Example
|
||||
//!
|
||||
//! ```ignore
|
||||
//! # use futures::{Future, future};
|
||||
//! use tokio_test::assert_ready;
|
||||
//!
|
||||
//! let mut fut = future::ok::<(), ()>(());
|
||||
//! assert_ready!(fut.poll());
|
||||
//! ```
|
||||
|
||||
pub mod clock;
|
||||
pub mod io;
|
||||
|
||||
@@ -1,21 +1,4 @@
|
||||
//! Futures task based helpers
|
||||
//!
|
||||
//! # Example
|
||||
//!
|
||||
//! This example will use the `MockTask` to set the current task on
|
||||
//! poll.
|
||||
//!
|
||||
//! ```ignore
|
||||
//! # use tokio_test::assert_ready_eq;
|
||||
//! # use tokio_test::task::MockTask;
|
||||
//! # use futures::{sync::mpsc, Stream, Sink, Future, Async};
|
||||
//! let mut task = MockTask::new();
|
||||
//! let (tx, mut rx) = mpsc::channel(5);
|
||||
//!
|
||||
//! tx.send(()).wait();
|
||||
//!
|
||||
//! assert_ready_eq!(task.enter(|| rx.poll()), Some(()));
|
||||
//! ```
|
||||
|
||||
use tokio_executor::enter;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user