1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-08-30 23:30:19 +02:00

add NewServiceExt tests

This commit is contained in:
Nikolay Kim
2018-09-17 19:21:24 -07:00
parent 90ad1b12a8
commit 4827990298
5 changed files with 67 additions and 5 deletions

View File

@@ -191,7 +191,7 @@ mod tests {
use futures::future::{err, FutureResult};
use super::*;
use service::{Service, ServiceExt};
use service::{IntoNewService, NewServiceExt, Service, ServiceExt};
struct Srv;
@@ -225,4 +225,17 @@ mod tests {
assert!(res.is_err());
assert_eq!(res.err().unwrap(), "error");
}
#[test]
fn test_new_service() {
let blank = || Ok::<_, ()>(Srv);
let new_srv = blank.into_new_service().map_err(|_| "error");
if let Async::Ready(mut srv) = new_srv.new_service().poll().unwrap() {
let res = srv.call(()).poll();
assert!(res.is_err());
assert_eq!(res.err().unwrap(), "error");
} else {
panic!()
}
}
}