diff --git a/tests/timer.rs b/tests/timer.rs index 060e3594c..72a5595d7 100644 --- a/tests/timer.rs +++ b/tests/timer.rs @@ -80,6 +80,7 @@ fn deadline() { let when = Instant::now() + Duration::from_millis(20); let (tx, rx) = mpsc::channel(); + #[allow(deprecated)] tokio::run({ future::empty::<(), ()>() .deadline(when) @@ -92,3 +93,24 @@ fn deadline() { rx.recv().unwrap(); } + +#[test] +fn timeout() { + use futures::future; + + let _ = env_logger::try_init(); + + let (tx, rx) = mpsc::channel(); + + tokio::run({ + future::empty::<(), ()>() + .timeout(Duration::from_millis(20)) + .then(move |res| { + assert!(res.is_err()); + tx.send(()).unwrap(); + Ok(()) + }) + }); + + rx.recv().unwrap(); +} diff --git a/tokio-timer/tests/deadline.rs b/tokio-timer/tests/deadline.rs index 229a23cbe..04cdc013e 100644 --- a/tokio-timer/tests/deadline.rs +++ b/tokio-timer/tests/deadline.rs @@ -1,3 +1,4 @@ +#![allow(deprecated)] extern crate futures; extern crate tokio_executor; extern crate tokio_timer;