1
1
#![ feature( core, std_misc) ]
2
- #![ cfg_attr( test, feature( old_io ) ) ]
2
+ #![ cfg_attr( test, feature( io , net ) ) ]
3
3
4
4
extern crate "route-recognizer" as router;
5
5
extern crate conduit;
@@ -124,8 +124,8 @@ impl<'a> RequestParams<'a> for &'a (Request + 'a) {
124
124
mod tests {
125
125
extern crate semver;
126
126
use std:: collections:: HashMap ;
127
- use std:: old_io :: { MemReader , IoError } ;
128
- use std:: old_io :: net:: ip :: IpAddr ;
127
+ use std:: io ;
128
+ use std:: net:: IpAddr ;
129
129
130
130
use { RouteBuilder , RequestParams } ;
131
131
@@ -162,7 +162,7 @@ mod tests {
162
162
fn remote_ip ( & self ) -> IpAddr { unimplemented ! ( ) }
163
163
fn content_length ( & self ) -> Option < u64 > { unimplemented ! ( ) }
164
164
fn headers < ' a > ( & ' a self ) -> & ' a Headers { unimplemented ! ( ) }
165
- fn body < ' a > ( & ' a mut self ) -> & ' a mut Reader { unimplemented ! ( ) }
165
+ fn body < ' a > ( & ' a mut self ) -> & ' a mut io :: Read { unimplemented ! ( ) }
166
166
fn extensions < ' a > ( & ' a self ) -> & ' a Extensions {
167
167
& self . extensions
168
168
}
@@ -178,7 +178,9 @@ mod tests {
178
178
let mut res = router. call ( & mut req) . ok ( ) . expect ( "No response" ) ;
179
179
180
180
assert_eq ! ( res. status, ( 200 , "OK" ) ) ;
181
- assert_eq ! ( res. body. read_to_string( ) . unwrap( ) , "1, Get" . to_string( ) ) ;
181
+ let mut s = String :: new ( ) ;
182
+ res. body . read_to_string ( & mut s) . unwrap ( ) ;
183
+ assert_eq ! ( s, "1, Get" . to_string( ) ) ;
182
184
}
183
185
184
186
#[ test]
@@ -188,7 +190,9 @@ mod tests {
188
190
let mut res = router. call ( & mut req) . ok ( ) . expect ( "No response" ) ;
189
191
190
192
assert_eq ! ( res. status, ( 200 , "OK" ) ) ;
191
- assert_eq ! ( res. body. read_to_string( ) . unwrap( ) , "10, Post" . to_string( ) ) ;
193
+ let mut s = String :: new ( ) ;
194
+ res. body . read_to_string ( & mut s) . unwrap ( ) ;
195
+ assert_eq ! ( s, "10, Post" . to_string( ) ) ;
192
196
}
193
197
194
198
#[ test]
@@ -205,16 +209,15 @@ mod tests {
205
209
router
206
210
}
207
211
208
- fn test_handler ( req : & mut conduit:: Request )
209
- -> Result < conduit:: Response , IoError > {
212
+ fn test_handler ( req : & mut conduit:: Request ) -> io:: Result < conduit:: Response > {
210
213
let mut res = vec ! ( ) ;
211
214
res. push ( req. params ( ) [ "id" ] . clone ( ) ) ;
212
215
res. push ( format ! ( "{:?}" , req. method( ) ) ) ;
213
216
214
217
Ok ( conduit:: Response {
215
218
status : ( 200 , "OK" ) ,
216
219
headers : HashMap :: new ( ) ,
217
- body : Box :: new ( MemReader :: new ( res. connect ( ", " ) . into_bytes ( ) ) )
220
+ body : Box :: new ( io :: Cursor :: new ( res. connect ( ", " ) . into_bytes ( ) ) )
218
221
} )
219
222
}
220
223
}
0 commit comments