Skip to content

Commit

Permalink
[Test] rope.rs: testing concat
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoric committed Nov 6, 2011
1 parent bc1316a commit 7bfe4db
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/stdtest/rope.rs
Expand Up @@ -2,6 +2,7 @@ import std::str;
import std::rope::*;
import std::option;
import std::uint;
import std::vec;

//Utility function, used for sanity check
fn rope_to_string(r: rope) -> str {
Expand Down Expand Up @@ -146,3 +147,18 @@ fn char_at1() {
assert eq(r2, r3);
assert eq(bal2, bal3);
}

#[test]
fn concat1() {
//Generate a reasonable rope
let chunk = of_str(@ "123456789");
let r = empty();
uint::range(0u, 10u){|_i|
r = append_rope(r, chunk);
}

//Same rope, obtained with rope::concat
let r2 = concat(vec::init_elt(chunk, 10u));

assert eq(r, r2);
}

0 comments on commit 7bfe4db

Please sign in to comment.