mirror of
https://github.com/actix/actix-web.git
synced 2025-02-01 20:02:20 +00:00
update apply tests
This commit is contained in:
parent
a91b9a2f9e
commit
20cff6fc0b
1 changed files with 7 additions and 3 deletions
|
@ -173,7 +173,7 @@ mod tests {
|
||||||
use futures::future::{ok, FutureResult};
|
use futures::future::{ok, FutureResult};
|
||||||
use futures::{Async, Future, Poll};
|
use futures::{Async, Future, Poll};
|
||||||
|
|
||||||
use service::{Service, ServiceExt};
|
use service::{IntoService, Service, ServiceExt};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct Srv;
|
struct Srv;
|
||||||
|
@ -194,8 +194,12 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_call() {
|
fn test_call() {
|
||||||
let mut srv =
|
let blank = |req| Ok(req);
|
||||||
Srv.apply(|req: &'static str, srv| srv.call(()).map(move |res| (req, res)));
|
|
||||||
|
let mut srv = blank.into_service().apply(Srv, |req: &'static str, srv| {
|
||||||
|
srv.call(()).map(move |res| (req, res))
|
||||||
|
});
|
||||||
|
assert!(srv.poll_ready().is_ok());
|
||||||
let res = srv.call("srv").poll();
|
let res = srv.call("srv").poll();
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
assert_eq!(res.unwrap(), Async::Ready(("srv", ())));
|
assert_eq!(res.unwrap(), Async::Ready(("srv", ())));
|
||||||
|
|
Loading…
Reference in a new issue