diff options
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/arrays.check | 2 | ||||
-rw-r--r-- | test/files/run/arrays.scala | 61 |
2 files changed, 39 insertions, 24 deletions
diff --git a/test/files/run/arrays.check b/test/files/run/arrays.check index a649c9b4f8..658b849025 100644 --- a/test/files/run/arrays.check +++ b/test/files/run/arrays.check @@ -1 +1 @@ -checks: 2301 +checks: 2304 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 //###################################################################### |