X-Git-Url: http://nitlanguage.org diff --git a/tests/test_ropes.nit b/tests/test_ropes.nit index 3040d12..c8829ee 100644 --- a/tests/test_ropes.nit +++ b/tests/test_ropes.nit @@ -12,17 +12,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -var x :String = new RopeString +import standard +intrude import standard::ropes -x = x + "NODE" -x = x + "AT" -x = x + "TEST" +# Force building a Rope +redef fun maxlen: Int do return once 2 + +var x :String = new Concat("NODE", "AT") + +x += "TEST" print x var lst = new List[String] -lst.push(new RopeString.from("ZZ")) +lst.push("ZZ") lst.push((lst.last * 5)) @@ -38,7 +42,7 @@ var ss = lst.last.substring(4,4) print ss -ss = ss.as(RopeString).insert_at("DD", 2) +ss = ss.insert_at("DD", 2) print ss @@ -64,16 +68,14 @@ print ss var atb = new Array[String] -var s = new RopeString -s = s.prepend(".types").as(RopeString) -s = s.prepend("./examples/hello_world.nit".substring(11,11)).as(RopeString) -s = s.append(".").as(RopeString) -s = s.append("1").as(RopeString) -s = s.append(".o").as(RopeString) +var s: String = "./examples/hello_world.nit".substring(11,11) + ".types" +s += "." +s += "1" +s += ".o" print s -var str = new RopeString.from("now") + " step" + " live..." +var str = "now" + " step" + " live..." print str @@ -99,16 +101,13 @@ printn "\n" for i in str.chars.iterator_from(str.length-1) do printn i printn "\n" -for i in str.as(RopeString).reverse_substrings_from(12) do printn i -printn "\n" - for i in str.chars.reverse_iterator do printn i printn "\n" for i in str.chars.reverse_iterator_from(0) do printn i printn "\n" -var str2 = str.as(RopeString).insert_at(str.substring_from(3), 3) +var str2 = str.insert_at(str.substring_from(3), 3) print str2