@@ -1225,9 +1225,8 @@ mod tests {
1225
1225
t ! ( s: Path :: new( "foo\\ ..\\ ..\\ .." ) , "..\\ .." ) ;
1226
1226
t ! ( s: Path :: new( "foo\\ ..\\ ..\\ bar" ) , "..\\ bar" ) ;
1227
1227
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" ) ) ;
1231
1230
1232
1231
t ! ( s: Path :: new( "\\ \\ a" ) , "\\ a" ) ;
1233
1232
t ! ( s: Path :: new( "\\ \\ a\\ " ) , "\\ a" ) ;
@@ -1581,7 +1580,8 @@ mod tests {
1581
1580
t!( s: "a\\ b\\ c" , [ ~"d", ~" e"], " a\\ b\\ c\\ d\\ e");
1582
1581
t!(v: b!(" a\\ b\\ c"), [b!(" d"), b!(" e")], b!(" a\\ b\\ c\\ d\\ e"));
1583
1582
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" ) ) ;
1585
1585
}
1586
1586
1587
1587
#[ test]
@@ -1720,7 +1720,8 @@ mod tests {
1720
1720
t!( s: "a\\ b\\ c" , [ "d" , "\\ e" , "f" ] , "\\ e\\ f" ) ;
1721
1721
t!( s: "a\\ b\\ c" , [ ~"d", ~" e"], " a\\ b\\ c\\ d\\ e");
1722
1722
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"));
1724
1725
}
1725
1726
1726
1727
#[test]
@@ -2235,33 +2236,25 @@ mod tests {
2235
2236
{
2236
2237
let path = Path :: new( $path) ;
2237
2238
let comps = path. str_components( ) . map( |x|x. unwrap( ) )
2238
- . collect:: <~ [ & str ] >( ) ;
2239
+ . collect:: <Vec < & str > >( ) ;
2239
2240
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) ;
2243
2242
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) ;
2249
2246
}
2250
2247
) ;
2251
2248
( v: [ $( $arg: expr) , +] , $exp: expr) => (
2252
2249
{
2253
2250
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 > >( ) ;
2255
2252
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) ;
2259
2254
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) ;
2265
2258
}
2266
2259
)
2267
2260
)
@@ -2312,15 +2305,12 @@ mod tests {
2312
2305
( s: $path: expr, $exp: expr) => (
2313
2306
{
2314
2307
let path = Path :: new( $path) ;
2315
- let comps = path. components( ) . collect:: <~ [ & [ u8 ] ] >( ) ;
2308
+ let comps = path. components( ) . collect:: <Vec < & [ u8 ] > >( ) ;
2316
2309
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) ;
2324
2314
}
2325
2315
)
2326
2316
)
0 commit comments