fix deprecation warning in test for FutureExt::deadline() (#651)

* silence deprecation warnings for deadline in tests
* add new integration test for timeout
This commit is contained in:
Sven Marnach
2018-09-20 15:26:56 -07:00
committed by Carl Lerche
parent e267a1922d
commit be67eda117
2 changed files with 23 additions and 0 deletions
+22
View File
@@ -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();
}
+1
View File
@@ -1,3 +1,4 @@
#![allow(deprecated)]
extern crate futures;
extern crate tokio_executor;
extern crate tokio_timer;