mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-27 08:41:36 +00:00
* 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:
committed by
Pierre Krieger
parent
4a894851ab
commit
490ae980c7
@ -119,8 +119,9 @@ where
|
||||
|
||||
#[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 stream_cipher::{ctr, Cipher};
|
||||
@ -164,8 +165,9 @@ mod tests {
|
||||
|
||||
let data_sent = encoder.send(BytesMut::from(data.to_vec())).from_err();
|
||||
let data_received = decoder.into_future().map(|(n, _)| n).map_err(|(e, _)| e);
|
||||
let mut rt = Runtime::new().unwrap();
|
||||
|
||||
let (_, decoded) = tokio_current_thread::block_on_all(data_sent.join(data_received))
|
||||
let (_, decoded) = rt.block_on(data_sent.join(data_received))
|
||||
.map_err(|_| ())
|
||||
.unwrap();
|
||||
assert_eq!(&decoded.unwrap()[..], &data[..]);
|
||||
@ -223,7 +225,8 @@ mod tests {
|
||||
.and_then(|server| server.into_future().map_err(|(e, _)| e.into()))
|
||||
.map(|recved| recved.0.unwrap().to_vec());
|
||||
|
||||
let received = tokio_current_thread::block_on_all(fin).unwrap();
|
||||
let mut rt = Runtime::new().unwrap();
|
||||
let received = rt.block_on(fin).unwrap();
|
||||
assert_eq!(received, data);
|
||||
}
|
||||
|
||||
|
@ -646,8 +646,9 @@ where ::hmac::Hmac<D>: Clone {
|
||||
|
||||
#[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::handshake;
|
||||
@ -712,8 +713,8 @@ mod tests {
|
||||
let client = TcpStream::connect(&listener_addr)
|
||||
.map_err(|e| e.into())
|
||||
.and_then(move |stream| handshake(stream, key2));
|
||||
|
||||
tokio_current_thread::block_on_all(server.join(client)).unwrap();
|
||||
let mut rt = Runtime::new().unwrap();
|
||||
let _ = rt.block_on(server.join(client)).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -30,7 +30,7 @@
|
||||
//!
|
||||
//! ```no_run
|
||||
//! extern crate futures;
|
||||
//! extern crate tokio_current_thread;
|
||||
//! extern crate tokio;
|
||||
//! extern crate tokio_io;
|
||||
//! extern crate libp2p_core;
|
||||
//! extern crate libp2p_secio;
|
||||
@ -42,6 +42,7 @@
|
||||
//! use libp2p_core::{Multiaddr, Transport, upgrade};
|
||||
//! use libp2p_tcp_transport::TcpConfig;
|
||||
//! use tokio_io::io::write_all;
|
||||
//! use tokio::runtime::current_thread::Runtime;
|
||||
//!
|
||||
//! let transport = TcpConfig::new()
|
||||
//! .with_upgrade({
|
||||
@ -63,7 +64,8 @@
|
||||
//! write_all(connection, "hello world")
|
||||
//! });
|
||||
//!
|
||||
//! tokio_current_thread::block_on_all(future).unwrap();
|
||||
//! let mut rt = Runtime::new().unwrap();
|
||||
//! let _ = rt.block_on(future).unwrap();
|
||||
//! # }
|
||||
//! ```
|
||||
//!
|
||||
|
Reference in New Issue
Block a user