@@ -1225,9 +1225,8 @@ mod tests {
12251225 t ! ( s: Path :: new( "foo\\ ..\\ ..\\ .." ) , "..\\ .." ) ;
12261226 t ! ( s: Path :: new( "foo\\ ..\\ ..\\ bar" ) , "..\\ bar" ) ;
12271227
1228- assert_eq ! ( Path :: new( b!( "foo\\ bar" ) ) . into_vec( ) , b!( "foo\\ bar" ) . to_owned( ) ) ;
1229- assert_eq ! ( Path :: new( b!( "\\ foo\\ ..\\ ..\\ bar" ) ) . into_vec( ) ,
1230- b!( "\\ bar" ) . to_owned( ) ) ;
1228+ assert_eq ! ( Path :: new( b!( "foo\\ bar" ) ) . into_vec( ) . as_slice( ) , b!( "foo\\ bar" ) ) ;
1229+ assert_eq ! ( Path :: new( b!( "\\ foo\\ ..\\ ..\\ bar" ) ) . into_vec( ) . as_slice( ) , b!( "\\ bar" ) ) ;
12311230
12321231 t ! ( s: Path :: new( "\\ \\ a" ) , "\\ a" ) ;
12331232 t ! ( s: Path :: new( "\\ \\ a\\ " ) , "\\ a" ) ;
@@ -1581,7 +1580,8 @@ mod tests {
15811580 t!( s: "a\\ b\\ c" , [ ~"d", ~" e"], " a\\ b\\ c\\ d\\ e");
15821581 t!(v: b!(" a\\ b\\ c"), [b!(" d"), b!(" e")], b!(" a\\ b\\ c\\ d\\ e"));
15831582 t!(v: b!(" a\\ b\\ c"), [b!(" d"), b!(" \\ e"), b!(" f")], b!("\\ e\\ f" ) ) ;
1584- t!( v: b!( "a\\ b\\ c" ) , [ b!( "d" ) . to_owned( ) , b!( "e" ) . to_owned( ) ] , b!( "a\\ b\\ c\\ d\\ e" ) ) ;
1583+ t!( v: b!( "a\\ b\\ c" ) , [ Vec :: from_slice( b!( "d" ) ) , Vec :: from_slice( b!( "e" ) ) ] ,
1584+ b!( "a\\ b\\ c\\ d\\ e" ) ) ;
15851585 }
15861586
15871587 #[ test]
@@ -1720,7 +1720,8 @@ mod tests {
17201720 t!( s: "a\\ b\\ c" , [ "d" , "\\ e" , "f" ] , "\\ e\\ f" ) ;
17211721 t!( s: "a\\ b\\ c" , [ ~"d", ~" e"], " a\\ b\\ c\\ d\\ e");
17221722 t!(v: b!(" a\\ b\\ c"), [b!(" d"), b!(" e")], b!(" a\\ b\\ c\\ d\\ e"));
1723- t!(v: b!(" a\\ b\\ c"), [b!(" d").to_owned(), b!(" e").to_owned()], b!(" a\\ b\\ c\\ d\\ e"));
1723+ t!(v: b!(" a\\ b\\ c"), [Vec::from_slice(b!(" d")), Vec::from_slice(b!(" e"))],
1724+ b!(" a\\ b\\ c\\ d\\ e"));
17241725 }
17251726
17261727 #[test]
@@ -2235,33 +2236,25 @@ mod tests {
22352236 {
22362237 let path = Path :: new( $path) ;
22372238 let comps = path. str_components( ) . map( |x|x. unwrap( ) )
2238- . collect:: <~ [ & str ] >( ) ;
2239+ . collect:: <Vec < & str > >( ) ;
22392240 let exp: & [ & str ] = $exp;
2240- assert!( comps. as_slice( ) == exp,
2241- "str_components: Expected {:?}, found {:?}" ,
2242- comps. as_slice( ) , exp) ;
2241+ assert_eq!( comps. as_slice( ) , exp) ;
22432242 let comps = path. rev_str_components( ) . map( |x|x. unwrap( ) )
2244- . collect:: <~[ & str ] >( ) ;
2245- let exp = exp. rev_iter( ) . map( |& x|x) . collect:: <~[ & str ] >( ) ;
2246- assert!( comps. as_slice( ) == exp,
2247- "rev_str_components: Expected {:?}, found {:?}" ,
2248- comps. as_slice( ) , exp) ;
2243+ . collect:: <Vec <& str >>( ) ;
2244+ let exp = exp. rev_iter( ) . map( |& x|x) . collect:: <Vec <& str >>( ) ;
2245+ assert_eq!( comps, exp) ;
22492246 }
22502247 ) ;
22512248 ( v: [ $( $arg: expr) , +] , $exp: expr) => (
22522249 {
22532250 let path = Path :: new( b!( $( $arg) , +) ) ;
2254- let comps = path. str_components( ) . map( |x|x. unwrap( ) ) . collect:: <~ [ & str ] >( ) ;
2251+ let comps = path. str_components( ) . map( |x|x. unwrap( ) ) . collect:: <Vec < & str > >( ) ;
22552252 let exp: & [ & str ] = $exp;
2256- assert!( comps. as_slice( ) == exp,
2257- "str_components: Expected {:?}, found {:?}" ,
2258- comps. as_slice( ) , exp) ;
2253+ assert_eq!( comps. as_slice( ) , exp) ;
22592254 let comps = path. rev_str_components( ) . map( |x|x. unwrap( ) )
2260- . collect:: <~[ & str ] >( ) ;
2261- let exp = exp. rev_iter( ) . map( |& x|x) . collect:: <~[ & str ] >( ) ;
2262- assert!( comps. as_slice( ) == exp,
2263- "rev_str_components: Expected {:?}, found {:?}" ,
2264- comps. as_slice( ) , exp) ;
2255+ . collect:: <Vec <& str >>( ) ;
2256+ let exp = exp. rev_iter( ) . map( |& x|x) . collect:: <Vec <& str >>( ) ;
2257+ assert_eq!( comps, exp) ;
22652258 }
22662259 )
22672260 )
@@ -2312,15 +2305,12 @@ mod tests {
23122305 ( s: $path: expr, $exp: expr) => (
23132306 {
23142307 let path = Path :: new( $path) ;
2315- let comps = path. components( ) . collect:: <~ [ & [ u8 ] ] >( ) ;
2308+ let comps = path. components( ) . collect:: <Vec < & [ u8 ] > >( ) ;
23162309 let exp: & [ & [ u8 ] ] = $exp;
2317- assert!( comps. as_slice( ) == exp, "components: Expected {:?}, found {:?}" ,
2318- comps. as_slice( ) , exp) ;
2319- let comps = path. rev_components( ) . collect:: <~[ & [ u8 ] ] >( ) ;
2320- let exp = exp. rev_iter( ) . map( |& x|x) . collect:: <~[ & [ u8 ] ] >( ) ;
2321- assert!( comps. as_slice( ) == exp,
2322- "rev_components: Expected {:?}, found {:?}" ,
2323- comps. as_slice( ) , exp) ;
2310+ assert_eq!( comps. as_slice( ) , exp) ;
2311+ let comps = path. rev_components( ) . collect:: <Vec <& [ u8 ] >>( ) ;
2312+ let exp = exp. rev_iter( ) . map( |& x|x) . collect:: <Vec <& [ u8 ] >>( ) ;
2313+ assert_eq!( comps, exp) ;
23242314 }
23252315 )
23262316 )
0 commit comments