@@ -31,7 +31,7 @@ async fn echo_path<State>(req: tide::Request<State>) -> tide::Result<String> {
3131}
3232
3333#[ async_std:: test]
34- async fn route_middleware ( ) {
34+ async fn route_middleware ( ) -> tide :: Result < ( ) > {
3535 let mut app = tide:: new ( ) ;
3636 let mut foo_route = app. at ( "/foo" ) ;
3737 foo_route // /foo
@@ -46,17 +46,18 @@ async fn route_middleware() {
4646 . reset_middleware ( )
4747 . put ( echo_path) ;
4848
49- assert_eq ! ( app. get( "/foo" ) . await [ "X-Foo" ] , "foo" ) ;
50- assert_eq ! ( app. post( "/foo" ) . await [ "X-Foo" ] , "foo" ) ;
51- assert ! ( app. put( "/foo" ) . await . header( "X-Foo" ) . is_none( ) ) ;
49+ assert_eq ! ( app. get( "/foo" ) . await ? [ "X-Foo" ] , "foo" ) ;
50+ assert_eq ! ( app. post( "/foo" ) . await ? [ "X-Foo" ] , "foo" ) ;
51+ assert ! ( app. put( "/foo" ) . await ? . header( "X-Foo" ) . is_none( ) ) ;
5252
53- let res = app. get ( "/foo/bar" ) . await ;
53+ let res = app. get ( "/foo/bar" ) . await ? ;
5454 assert_eq ! ( res[ "X-Foo" ] , "foo" ) ;
5555 assert_eq ! ( res[ "x-bar" ] , "bar" ) ;
56+ Ok ( ( ) )
5657}
5758
5859#[ async_std:: test]
59- async fn app_and_route_middleware ( ) {
60+ async fn app_and_route_middleware ( ) -> tide :: Result < ( ) > {
6061 let mut app = tide:: new ( ) ;
6162 app. with ( TestMiddleware :: with_header_name ( "X-Root" , "root" ) ) ;
6263 app. at ( "/foo" )
@@ -66,19 +67,20 @@ async fn app_and_route_middleware() {
6667 . with ( TestMiddleware :: with_header_name ( "X-Bar" , "bar" ) )
6768 . get ( echo_path) ;
6869
69- let res = app. get ( "/foo" ) . await ;
70+ let res = app. get ( "/foo" ) . await ? ;
7071 assert_eq ! ( res[ "X-Root" ] , "root" ) ;
7172 assert_eq ! ( res[ "x-foo" ] , "foo" ) ;
7273 assert ! ( res. header( "x-bar" ) . is_none( ) ) ;
7374
74- let res = app. get ( "/bar" ) . await ;
75+ let res = app. get ( "/bar" ) . await ? ;
7576 assert_eq ! ( res[ "X-Root" ] , "root" ) ;
7677 assert ! ( res. header( "x-foo" ) . is_none( ) ) ;
7778 assert_eq ! ( res[ "X-Bar" ] , "bar" ) ;
79+ Ok ( ( ) )
7880}
7981
8082#[ async_std:: test]
81- async fn nested_app_with_route_middleware ( ) {
83+ async fn nested_app_with_route_middleware ( ) -> tide :: Result < ( ) > {
8284 let mut inner = tide:: new ( ) ;
8385 inner. with ( TestMiddleware :: with_header_name ( "X-Inner" , "inner" ) ) ;
8486 inner
@@ -95,23 +97,24 @@ async fn nested_app_with_route_middleware() {
9597 . with ( TestMiddleware :: with_header_name ( "X-Bar" , "bar" ) )
9698 . nest ( inner) ;
9799
98- let res = app. get ( "/foo" ) . await ;
100+ let res = app. get ( "/foo" ) . await ? ;
99101 assert_eq ! ( res[ "X-Root" ] , "root" ) ;
100102 assert ! ( res. header( "X-Inner" ) . is_none( ) ) ;
101103 assert_eq ! ( res[ "X-Foo" ] , "foo" ) ;
102104 assert ! ( res. header( "X-Bar" ) . is_none( ) ) ;
103105 assert ! ( res. header( "X-Baz" ) . is_none( ) ) ;
104106
105- let res = app. get ( "/bar/baz" ) . await ;
107+ let res = app. get ( "/bar/baz" ) . await ? ;
106108 assert_eq ! ( res[ "X-Root" ] , "root" ) ;
107109 assert_eq ! ( res[ "X-Inner" ] , "inner" ) ;
108110 assert ! ( res. header( "X-Foo" ) . is_none( ) ) ;
109111 assert_eq ! ( res[ "X-Bar" ] , "bar" ) ;
110112 assert_eq ! ( res[ "X-Baz" ] , "baz" ) ;
113+ Ok ( ( ) )
111114}
112115
113116#[ async_std:: test]
114- async fn subroute_not_nested ( ) {
117+ async fn subroute_not_nested ( ) -> tide :: Result < ( ) > {
115118 let mut app = tide:: new ( ) ;
116119 app. at ( "/parent" ) // /parent
117120 . with ( TestMiddleware :: with_header_name ( "X-Parent" , "Parent" ) )
@@ -120,7 +123,8 @@ async fn subroute_not_nested() {
120123 . with ( TestMiddleware :: with_header_name ( "X-Child" , "child" ) )
121124 . get ( echo_path) ;
122125
123- let res = app. get ( "/parent/child" ) . await ;
126+ let res = app. get ( "/parent/child" ) . await ? ;
124127 assert ! ( res. header( "X-Parent" ) . is_none( ) ) ;
125128 assert_eq ! ( res[ "x-child" ] , "child" ) ;
129+ Ok ( ( ) )
126130}
0 commit comments