Skip to content

Commit 7bfe4db

Browse files
author
David Rajchenbach-Teller
committed
[Test] rope.rs: testing concat
1 parent bc1316a commit 7bfe4db

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/test/stdtest/rope.rs

+16
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import std::str;
22
import std::rope::*;
33
import std::option;
44
import std::uint;
5+
import std::vec;
56

67
//Utility function, used for sanity check
78
fn rope_to_string(r: rope) -> str {
@@ -146,3 +147,18 @@ fn char_at1() {
146147
assert eq(r2, r3);
147148
assert eq(bal2, bal3);
148149
}
150+
151+
#[test]
152+
fn concat1() {
153+
//Generate a reasonable rope
154+
let chunk = of_str(@ "123456789");
155+
let r = empty();
156+
uint::range(0u, 10u){|_i|
157+
r = append_rope(r, chunk);
158+
}
159+
160+
//Same rope, obtained with rope::concat
161+
let r2 = concat(vec::init_elt(chunk, 10u));
162+
163+
assert eq(r, r2);
164+
}

0 commit comments

Comments
 (0)