#399 remove tokio_current_thread tests (#577)

* remove tokio_current_thread tests

* Review changes:
Removed newline
Moved uds tokio test crate to top to avoid self and keep with convention of other test crates
Removed sleep from uds test and block until all futures are completed.
This commit is contained in:
jamartin9
2018-10-25 05:26:37 -04:00
committed by Pierre Krieger
parent 4a894851ab
commit 490ae980c7
27 changed files with 117 additions and 82 deletions

View File

@ -53,11 +53,12 @@
//! extern crate libp2p_ping;
//! extern crate libp2p_core;
//! extern crate libp2p_tcp_transport;
//! extern crate tokio_current_thread;
//! extern crate tokio;
//!
//! use futures::{Future, Stream};
//! use libp2p_ping::{Ping, PingOutput};
//! use libp2p_core::Transport;
//! use tokio::runtime::current_thread::Runtime;
//!
//! # fn main() {
//! let ping_finished_future = libp2p_tcp_transport::TcpConfig::new()
@ -75,7 +76,8 @@
//! });
//!
//! // Runs until the ping arrives.
//! tokio_current_thread::block_on_all(ping_finished_future).unwrap();
//! let mut rt = Runtime::new().unwrap();
//! let _ = rt.block_on(ping_finished_future).unwrap();
//! # }
//! ```
//!
@ -391,9 +393,10 @@ impl Encoder for Codec {
#[cfg(test)]
mod tests {
extern crate tokio_current_thread;
extern crate tokio;
extern crate tokio_tcp;
use self::tokio::runtime::current_thread::Runtime;
use self::tokio_tcp::TcpListener;
use self::tokio_tcp::TcpStream;
use super::{Ping, PingOutput};
@ -440,8 +443,8 @@ mod tests {
_ => unreachable!(),
})
.map(|_| ());
tokio_current_thread::block_on_all(server.select(client).map_err(|_| panic!())).unwrap();
let mut rt = Runtime::new().unwrap();
let _ = rt.block_on(server.select(client).map_err(|_| panic!())).unwrap();
}
#[test]
@ -489,7 +492,7 @@ mod tests {
},
_ => unreachable!(),
});
tokio_current_thread::block_on_all(server.select(client)).unwrap_or_else(|_| panic!());
let mut rt = Runtime::new().unwrap();
let _ = rt.block_on(server.select(client)).unwrap_or_else(|_| panic!());
}
}