about summary refs log tree commit diff
path: root/src/test/stdtest
diff options
context:
space:
mode:
authorDavid Rajchenbach-Teller <dteller@mozilla.com>2011-11-06 17:27:24 +0100
committerDavid Rajchenbach-Teller <dteller@mozilla.com>2011-11-06 18:10:23 +0100
commit7bfe4dba807ae908a247a34a4f72d0b610e6376f (patch)
tree125246aeb3ecfb344e75a3ec8acb6e3e76dd9454 /src/test/stdtest
parentbc1316aaf4f2609b6f8542242d9c3ca65d0853bd (diff)
[Test] rope.rs: testing concat
Diffstat (limited to 'src/test/stdtest')
-rw-r--r--src/test/stdtest/rope.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/stdtest/rope.rs b/src/test/stdtest/rope.rs
index f8e897e6811..1ed920f2fb9 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