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:
@@ -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!()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user