From 66515781fa9823e200779e5d53aa244e46e22f02 Mon Sep 17 00:00:00 2001 From: michelou Date: Wed, 2 Apr 2008 11:02:48 +0000 Subject: fixed #713 --- test/files/run/arrays.check | 2 +- test/files/run/arrays.scala | 61 ++++++++++++++++++++++++++++----------------- 2 files changed, 39 insertions(+), 24 deletions(-) (limited to 'test') 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(aaa, xxx) + val y3 = aaaxxx; + check(x3 sameElements y3, x3.toList, y3.toList) + } + //########################################################################## // Arrays @@ -911,7 +925,8 @@ object Test { //###################################################################### - checkZip() + checkZip + checkConcat //###################################################################### -- cgit v1.2.3