diff options
author | michelou <michelou@epfl.ch> | 2008-04-02 11:02:48 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2008-04-02 11:02:48 +0000 |
commit | 66515781fa9823e200779e5d53aa244e46e22f02 (patch) | |
tree | f3824c1db7d18a44bb9a83b42c11c36998937c81 /test/files/run/arrays.scala | |
parent | 22d46fbdedc7ec93b1dccaa7f1dc85b17b6d549b (diff) | |
download | scala-66515781fa9823e200779e5d53aa244e46e22f02.tar.gz scala-66515781fa9823e200779e5d53aa244e46e22f02.tar.bz2 scala-66515781fa9823e200779e5d53aa244e46e22f02.zip |
fixed #713
Diffstat (limited to 'test/files/run/arrays.scala')
-rw-r--r-- | test/files/run/arrays.scala | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/test/files/run/arrays.scala b/test/files/run/arrays.scala index 927112d851..a58caded00 100644 --- a/test/files/run/arrays.scala +++ b/test/files/run/arrays.scala @@ -10,10 +10,10 @@ object Test { //########################################################################## // Types - type Strings = List[String]; - type Map = scala.collection.Map[Int, Any]; - type HashMap = scala.collection.mutable.HashMap[Int, Any]; - type TreeMap = scala.collection.immutable.TreeMap[Int, Any]; + type Strings = List[String] + type Map = scala.collection.Map[Int, Any] + type HashMap = scala.collection.mutable.HashMap[Int, Any] + type TreeMap = scala.collection.immutable.TreeMap[Int, Any] //########################################################################## // Identity Functions @@ -142,21 +142,21 @@ object Test { } def check_Tm[T <: Map ](xs: Array[T], l: Int, x0: T, c: Check[T]) { - check(xs.length == l, xs.length, l); - check(xs(0) == x0, xs(0), x0); - check_Ta(xs, l, x0, c); - check_Tr(xs, l, x0, c); - check_To(xs, l, x0, c); - c(xs); + check(xs.length == l, xs.length, l) + check(xs(0) == x0, xs(0), x0) + check_Ta(xs, l, x0, c) + check_Tr(xs, l, x0, c) + check_To(xs, l, x0, c) + c(xs) } def check_Tn[T <: Strings](xs: Array[T], l: Int, x0: T, c: Check[T]) { - check(xs.length == l, xs.length, l); - check(xs(0) == x0, xs(0), x0); - check_Ta(xs, l, x0, c); - check_Tr(xs, l, x0, c); - check_To(xs, l, x0, c); - c(xs); + check(xs.length == l, xs.length, l) + check(xs(0) == x0, xs(0), x0) + check_Ta(xs, l, x0, c) + check_Tr(xs, l, x0, c) + check_To(xs, l, x0, c) + c(xs) } //########################################################################## @@ -328,21 +328,35 @@ object Test { check(xs(2) == m2, xs(2), m2); } - def ncheck(xs: Array[Strings]): Unit = { - check(xs.length == 3, xs.length, 3); - check(xs(0) == n0, xs(0), n0); - check(xs(1) == n1, xs(1), n1); - check(xs(2) == n2, xs(2), n2); + def ncheck(xs: Array[Strings]) { + check(xs.length == 3, xs.length, 3) + check(xs(0) == n0, xs(0), n0) + check(xs(1) == n1, xs(1), n1) + check(xs(2) == n2, xs(2), n2) } //########################################################################## // Miscellaneous checks - def checkZip(): Unit = { + + def checkZip { val zipped = Array("a", "b", "c").zip(Array(1, 2)) val expected = Array(("a",1), ("b",2)) check(zipped sameElements expected, zipped.toList, expected.toList) } + def checkConcat { // ticket #713 + val x1 = Array.concat(Array(1, 2), Array(3, 4)) + val y1 = Array(1, 2, 3, 4) + check(x1 sameElements y1, x1.toList, y1.toList) + + val x2 = Array.concat(List(1, 2), List(3, 4)) + check(x2 sameElements y1, x2.toList, y1.toList) + + val x3 = Array.concat(<a>aaa</a>, <x>xxx</x>) + val y3 = <a>aaa</a><x>xxx</x>; + check(x3 sameElements y3, x3.toList, y3.toList) + } + //########################################################################## // Arrays @@ -911,7 +925,8 @@ object Test { //###################################################################### - checkZip() + checkZip + checkConcat //###################################################################### |