test(client): Re-enable the tests/client.rs test
				
					
				
			These tests were temporarily disabled during the migration to the `std::future::Future` type that's part of the stable Rust now. This commit updates the tests after the breaking changes and makes them pass again.
This commit is contained in:
		
				
					committed by
					
						 Sean McArthur
						Sean McArthur
					
				
			
			
				
	
			
			
			
						parent
						
							0d3cbe28fc
						
					
				
				
					commit
					d683e13ecb
				
			| @@ -38,16 +38,18 @@ pin-utils = "0.1.0-alpha.4" | ||||
| time = "0.1" | ||||
| tokio = { git = "https://github.com/tokio-rs/tokio", optional = true, default-features = false, features = ["rt-full"] } | ||||
| tokio-buf = "0.1" | ||||
| tokio-current-thread = { git = "https://github.com/tokio-rs/tokio" } | ||||
| tokio-executor = { git = "https://github.com/tokio-rs/tokio" } | ||||
| tokio-io = { git = "https://github.com/tokio-rs/tokio" } | ||||
| tokio-reactor = { git = "https://github.com/tokio-rs/tokio", optional = true } | ||||
| tokio-sync = { git = "https://github.com/tokio-rs/tokio" } | ||||
| tokio-tcp = { git = "https://github.com/tokio-rs/tokio", optional = true } | ||||
| tokio-tcp = { git = "https://github.com/tokio-rs/tokio", optional = true, features = ["async-traits"] } | ||||
| tokio-threadpool = { git = "https://github.com/tokio-rs/tokio", optional = true } | ||||
| tokio-timer = { git = "https://github.com/tokio-rs/tokio", optional = true } | ||||
| want = { git = "https://github.com/seanmonstar/want", branch = "std-future" } | ||||
|  | ||||
| [dev-dependencies] | ||||
| matches = "0.1" | ||||
| num_cpus = "1.0" | ||||
| pretty_env_logger = "0.3" | ||||
| spmc = "0.2" | ||||
|   | ||||
| @@ -553,15 +553,16 @@ mod tests { | ||||
|     // FIXME: re-implement tests with `async/await`, this import should | ||||
|     // trigger a warning to remind us | ||||
|     use crate::Error; | ||||
|     use futures_util::try_stream::TryStreamExt; | ||||
|     use tokio::runtime::current_thread::Runtime; | ||||
|  | ||||
|     /* | ||||
|     use super::*; | ||||
|     #[test] | ||||
|     fn test_body_stream_concat() { | ||||
|         let body = Body::from("hello world"); | ||||
|  | ||||
|         let total = body.concat2().wait().unwrap(); | ||||
|         let mut rt = Runtime::new().unwrap(); | ||||
|         let total = rt.block_on(body.try_concat()).unwrap(); | ||||
|         assert_eq!(total.as_ref(), b"hello world"); | ||||
|     } | ||||
|     */ | ||||
| } | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,9 +1,8 @@ | ||||
| pub extern crate futures; | ||||
| pub extern crate hyper; | ||||
| pub extern crate tokio; | ||||
| 
 | ||||
| use std::sync::{Arc, Mutex, atomic::{AtomicUsize, Ordering}}; | ||||
| use std::time::Duration; | ||||
| use std::time::{Duration, Instant}; | ||||
| 
 | ||||
| use crate::hyper::{Body, Client, Request, Response, Server, Version}; | ||||
| use crate::hyper::client::HttpConnector; | ||||
| @@ -11,7 +10,7 @@ use crate::hyper::service::service_fn; | ||||
| 
 | ||||
| pub use std::net::SocketAddr; | ||||
| pub use self::futures::{future, Future, Stream}; | ||||
| pub use self::futures::sync::oneshot; | ||||
| pub use self::futures_channel::oneshot; | ||||
| pub use self::hyper::{HeaderMap, StatusCode}; | ||||
| pub use self::tokio::runtime::current_thread::Runtime; | ||||
| 
 | ||||
| @@ -341,7 +340,7 @@ pub fn __run_test(cfg: __TestConfig) { | ||||
|             } | ||||
|             let sbody = sreq.body; | ||||
|             req.into_body() | ||||
|                 .concat2() | ||||
|                 .try_concat() | ||||
|                 .map(move |body| { | ||||
|                     assert_eq!(body.as_ref(), sbody.as_slice(), "client body"); | ||||
| 
 | ||||
| @@ -417,7 +416,7 @@ pub fn __run_test(cfg: __TestConfig) { | ||||
|                 for func in &cheaders { | ||||
|                     func(&res.headers()); | ||||
|                 } | ||||
|                 res.into_body().concat2() | ||||
|                 res.into_body().try_concat() | ||||
|             }) | ||||
|             .map(move |body| { | ||||
|                 assert_eq!(body.as_ref(), cbody.as_slice(), "server body"); | ||||
		Reference in New Issue
	
	Block a user