mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 16:15:03 +00:00
[Test] rope.rs: testing concat
This commit is contained in:
parent
bc1316aaf4
commit
7bfe4dba80
@ -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 {
|
||||
@ -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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user