Skip to content

Commit a813469

Browse files
author
bluss
committed
string: Add test for FromIterator<&str> and Extend<&str>
1 parent 56c4e97 commit a813469

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/libcollections/string.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,11 +1337,18 @@ mod tests {
13371337
let u = "Việt Nam";
13381338

13391339
let a: String = s.chars().collect();
1340-
assert_eq!(s, a.as_slice());
1340+
assert_eq!(s, a);
13411341

13421342
let mut b = t.to_string();
13431343
b.extend(u.chars());
1344-
assert_eq!(s, b.as_slice());
1344+
assert_eq!(s, b);
1345+
1346+
let c: String = vec![t, u].into_iter().collect();
1347+
assert_eq!(s, c);
1348+
1349+
let mut d = t.to_string();
1350+
d.extend(vec![u].into_iter());
1351+
assert_eq!(s, d);
13451352
}
13461353

13471354
#[bench]

0 commit comments

Comments
 (0)