Convert str::concat to ivecs

This commit is contained in:
Brian Anderson 2011-08-11 17:52:40 -07:00
parent 1e397eee2a
commit 09cc957030
2 changed files with 5 additions and 5 deletions

View File

@ -449,7 +449,7 @@ fn split(s: str, sep: u8) -> [str] {
ret v;
}
fn concat(v: vec[str]) -> str {
fn concat(v: &[str]) -> str {
let s: str = "";
for ss: str in v { s += ss; }
ret s;

View File

@ -69,11 +69,11 @@ fn test_substr() {
#[test]
fn test_concat() {
fn t(v: &vec[str], s: &str) { assert (str::eq(str::concat(v), s)); }
t(["you", "know", "I'm", "no", "good"], "youknowI'mnogood");
let v: vec[str] = [];
fn t(v: &[str], s: &str) { assert (str::eq(str::concat(v), s)); }
t(~["you", "know", "I'm", "no", "good"], "youknowI'mnogood");
let v: [str] = ~[];
t(v, "");
t(["hi"], "hi");
t(~["hi"], "hi");
}
#[test]