From 7bfe4dba807ae908a247a34a4f72d0b610e6376f Mon Sep 17 00:00:00 2001 From: David Rajchenbach-Teller Date: Sun, 6 Nov 2011 17:27:24 +0100 Subject: [PATCH] [Test] rope.rs: testing concat --- src/test/stdtest/rope.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/stdtest/rope.rs b/src/test/stdtest/rope.rs index f8e897e68114..1ed920f2fb9f 100644 --- a/src/test/stdtest/rope.rs +++ b/src/test/stdtest/rope.rs @@ -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); +} \ No newline at end of file