summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/Course-2002-10.scala2
-rw-r--r--test/files/run/arrays.scala30
-rw-r--r--test/files/run/bug1044.scala2
-rw-r--r--test/files/run/bug1309.scala2
-rw-r--r--test/files/run/bug2005.scala2
-rw-r--r--test/files/run/indexedSeq-apply.check (renamed from test/files/run/randomAccessSeq-apply.check)0
-rw-r--r--test/files/run/indexedSeq-apply.scala (renamed from test/files/run/randomAccessSeq-apply.scala)6
-rw-r--r--test/files/run/iq.scala4
-rw-r--r--test/files/run/iterators.scala10
-rw-r--r--test/files/run/json.scala8
-rw-r--r--test/files/run/lists-run.scala14
-rw-r--r--test/files/run/map_java_conversions.scala2
-rw-r--r--test/files/run/multi-array.scala4
-rw-r--r--test/files/run/packrat1.scala2
-rw-r--r--test/files/run/packrat2.scala2
-rw-r--r--test/files/run/packrat3.scala2
-rw-r--r--test/files/run/repl-suppressed-warnings.check2
-rw-r--r--test/files/run/repl-suppressed-warnings.scala2
-rw-r--r--test/files/run/sort.scala12
-rw-r--r--test/files/run/stream_length.scala2
-rw-r--r--test/files/run/t0017.scala2
-rw-r--r--test/files/run/t0421.scala6
-rw-r--r--test/files/run/t0677.scala3
-rw-r--r--test/files/run/t2417.scala6
-rw-r--r--test/files/run/t2813.2.scala8
-rw-r--r--test/files/run/tailcalls.scala2
-rw-r--r--test/files/run/unapply.scala4
-rw-r--r--test/files/run/unittest_io.scala25
28 files changed, 84 insertions, 82 deletions
diff --git a/test/files/run/Course-2002-10.scala b/test/files/run/Course-2002-10.scala
index e978bc8258..4cfa1deb04 100644
--- a/test/files/run/Course-2002-10.scala
+++ b/test/files/run/Course-2002-10.scala
@@ -2,7 +2,7 @@
// Programmation IV - 2002 - Week 10
//############################################################################
-import Math.{Pi, log}
+import math.{Pi, log}
object M0 {
diff --git a/test/files/run/arrays.scala b/test/files/run/arrays.scala
index cd1cf13793..ecebc78a6f 100644
--- a/test/files/run/arrays.scala
+++ b/test/files/run/arrays.scala
@@ -167,41 +167,39 @@ object Test {
//##########################################################################
// Values
- import Math._
-
val u0: Unit = ();
val u1: Unit = ();
val z0: Boolean = false;
val z1: Boolean = true;
- val b0: Byte = MIN_BYTE;
+ val b0: Byte = Byte.MinValue;
val b1: Byte = 1;
- val b2: Byte = MAX_BYTE;
+ val b2: Byte = Byte.MaxValue;
- val s0: Short = MIN_SHORT;
+ val s0: Short = Short.MinValue;
val s1: Short = 2;
- val s2: Short = MAX_SHORT;
+ val s2: Short = Short.MaxValue;
- val c0: Char = MIN_CHAR;
+ val c0: Char = Char.MinValue;
val c1: Char = '3';
- val c2: Char = MAX_CHAR;
+ val c2: Char = Char.MaxValue;
- val i0: Int = MIN_INT;
+ val i0: Int = Int.MinValue;
val i1: Int = 4;
- val i2: Int = MAX_INT;
+ val i2: Int = Int.MinValue;
- val l0: Long = MIN_LONG;
+ val l0: Long = Long.MinValue;
val l1: Int = 5;
- val l2: Long = MAX_LONG;
+ val l2: Long = Long.MaxValue;
- val f0: Float = MIN_FLOAT;
+ val f0: Float = Float.MinValue;
val f1: Int = 6;
- val f2: Float = MAX_FLOAT;
+ val f2: Float = Float.MaxValue;
- val d0: Double = MIN_DOUBLE;
+ val d0: Double = Double.MinValue;
val d1: Int = 7;
- val d2: Double = MAX_DOUBLE;
+ val d2: Double = Double.MaxValue;
val a0: Unit = ();
val a1: Boolean = false;
diff --git a/test/files/run/bug1044.scala b/test/files/run/bug1044.scala
index 7ac5058607..4d37a40c81 100644
--- a/test/files/run/bug1044.scala
+++ b/test/files/run/bug1044.scala
@@ -1,4 +1,4 @@
object Test extends App {
val ducks = Array[AnyRef]("Huey", "Dewey", "Louie");
- ducks.elements.asInstanceOf[Iterator[String]]
+ ducks.iterator.asInstanceOf[Iterator[String]]
}
diff --git a/test/files/run/bug1309.scala b/test/files/run/bug1309.scala
index d753f4d96c..84963549a2 100644
--- a/test/files/run/bug1309.scala
+++ b/test/files/run/bug1309.scala
@@ -1,5 +1,5 @@
object Test {
- def f(ras: => RandomAccessSeq[Byte]): RandomAccessSeq[Byte] = ras
+ def f(ras: => IndexedSeq[Byte]): IndexedSeq[Byte] = ras
def main(args: Array[String]): Unit = {
f(new Array[Byte](0))
diff --git a/test/files/run/bug2005.scala b/test/files/run/bug2005.scala
index 4176709537..45da9fe5b2 100644
--- a/test/files/run/bug2005.scala
+++ b/test/files/run/bug2005.scala
@@ -1,6 +1,6 @@
object Test {
def main(args: Array[String]) {
- val a = new Array[Array[Int]](2,2)
+ val a = Array.ofDim[Int](2,2)
test(a)
}
def test[A](t: Array[Array[A]]) {
diff --git a/test/files/run/randomAccessSeq-apply.check b/test/files/run/indexedSeq-apply.check
index d86bac9de5..d86bac9de5 100644
--- a/test/files/run/randomAccessSeq-apply.check
+++ b/test/files/run/indexedSeq-apply.check
diff --git a/test/files/run/randomAccessSeq-apply.scala b/test/files/run/indexedSeq-apply.scala
index 9097038c51..39d4db2ce9 100644
--- a/test/files/run/randomAccessSeq-apply.scala
+++ b/test/files/run/indexedSeq-apply.scala
@@ -1,11 +1,11 @@
object Test extends App {
- val empty = RandomAccessSeq()
+ val empty = IndexedSeq()
assert(empty.isEmpty)
- val single = RandomAccessSeq(1)
+ val single = IndexedSeq(1)
assert(List(1) == single.toList)
- val two = RandomAccessSeq("a", "b")
+ val two = IndexedSeq("a", "b")
assert("a" == two.head)
assert("b" == two.apply(1))
diff --git a/test/files/run/iq.scala b/test/files/run/iq.scala
index 88a2884fcc..31859cf867 100644
--- a/test/files/run/iq.scala
+++ b/test/files/run/iq.scala
@@ -7,7 +7,7 @@ import scala.collection.immutable.Queue
object iq {
def main {
/* Create an empty queue. */
- val q: Queue[Int] = Queue.Empty
+ val q: Queue[Int] = Queue.empty
/* Test isEmpty.
* Expected: Empty
@@ -45,7 +45,7 @@ object iq {
*/
Console.println("q5[5]: " + q5(5))
- val q5c: Queue[Int] = Queue.Empty.enqueue(List(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))
+ val q5c: Queue[Int] = Queue.empty.enqueue(List(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))
/* Testing ==
* Expected: q5 == q9: true
diff --git a/test/files/run/iterators.scala b/test/files/run/iterators.scala
index 5f77289343..60eccdc8cc 100644
--- a/test/files/run/iterators.scala
+++ b/test/files/run/iterators.scala
@@ -75,11 +75,11 @@ object Test {
def check_fromArray: Int = { // ticket #429
val a = List(1, 2, 3, 4).toArray
- var xs0 = Iterator.fromArray(a).toList;
- var xs1 = Iterator.fromArray(a, 0, 1).toList;
- var xs2 = Iterator.fromArray(a, 0, 2).toList;
- var xs3 = Iterator.fromArray(a, 0, 3).toList;
- var xs4 = Iterator.fromArray(a, 0, 4).toList;
+ var xs0 = a.iterator.toList;
+ var xs1 = a.slice(0, 1).iterator.toList;
+ var xs2 = a.slice(0, 2).iterator.toList;
+ var xs3 = a.slice(0, 3).iterator.toList;
+ var xs4 = a.slice(0, 4).iterator.toList;
xs0.length + xs1.length + xs2.length + xs3.length + xs4.length
}
diff --git a/test/files/run/json.scala b/test/files/run/json.scala
index 7b2b80718c..8ee8c347fd 100644
--- a/test/files/run/json.scala
+++ b/test/files/run/json.scala
@@ -7,8 +7,8 @@ object Test extends App {
* toString comparison. */
def jsonToString(in : Any) : String = in match {
case l : List[_] => "[" + l.map(jsonToString).mkString(", ") + "]"
- case m : Map[String,_] => "{" + m.elements.toList
- .sort({ (x,y) => x._1 < y._1 })
+ case m : Map[String,_] => "{" + m.iterator.toList
+ .sortWith({ (x,y) => x._1 < y._1 })
.map({ case (k,v) => "\"" + k + "\": " + jsonToString(v) })
.mkString(", ") + "}"
case s : String => "\"" + s + "\""
@@ -20,7 +20,7 @@ object Test extends App {
*/
def sortJSON(in : Any) : Any = in match {
case l : List[_] => l.map(sortJSON)
- case m : Map[String,_] => TreeMap(m.mapElements(sortJSON).elements.toSeq : _*)
+ case m : Map[String,_] => TreeMap(m.mapValues(sortJSON).iterator.toSeq : _*)
// For the object versions, sort their contents, ugly casts and all...
case JSONObject(data) => JSONObject(sortJSON(data).asInstanceOf[Map[String,Any]])
case JSONArray(data) => JSONArray(sortJSON(data).asInstanceOf[List[Any]])
@@ -62,7 +62,7 @@ object Test extends App {
def stringDiff (expected : String, actual : String) {
if (expected != actual) {
// Figure out where the Strings differ and generate a marker
- val mismatchPosition = expected.toList.zip(actual.toList).findIndexOf({case (x,y) => x != y}) match {
+ val mismatchPosition = expected.toList.zip(actual.toList).indexWhere({case (x,y) => x != y}) match {
case -1 => Math.min(expected.length, actual.length)
case x => x
}
diff --git a/test/files/run/lists-run.scala b/test/files/run/lists-run.scala
index 9e9e49e818..13fca22982 100644
--- a/test/files/run/lists-run.scala
+++ b/test/files/run/lists-run.scala
@@ -25,7 +25,7 @@ object Test_multiset {
assert(List(1, 2) == (ys intersect xs), "ys_intersect_xs")
assert(List(1) == (xs diff ys), "xs_diff_ys")
assert(List(2, 3) == (ys diff xs), "ys_diff_xs")
- assert(isSubListOf(xs -- ys, xs diff ys), "xs_subset_ys")
+ assert(isSubListOf(xs filterNot (ys contains), xs diff ys), "xs_subset_ys")
val zs = List(0, 1, 1, 2, 2, 2)
assert(List(0, 1, 1, 2, 2, 2, 1, 2, 2, 3) == (zs union ys), "zs_union_ys")
@@ -34,7 +34,7 @@ object Test_multiset {
assert(List(1, 2, 2) == (ys intersect zs), "ys_intersect_zs")
assert(List(0, 1, 2) == (zs diff ys), "zs_diff_ys")
assert(List(3) == (ys diff zs), "ys_diff_zs")
- assert(isSubListOf(zs -- ys, zs diff ys), "xs_subset_ys")
+ assert(isSubListOf(zs filterNot (ys contains), zs diff ys), "xs_subset_ys")
val ws = List(2)
assert(List(2, 1, 2, 2, 3) == (ws union ys), "ws_union_ys")
@@ -43,7 +43,7 @@ object Test_multiset {
assert(List(2) == (ys intersect ws), "ys_intersect_ws")
assert(List() == (ws diff ys), "ws_diff_ys")
assert(List(1, 2, 3) == (ys diff ws), "ys_diff_ws")
- assert(isSubListOf(ws -- ys, ws diff ys), "ws_subset_ys")
+ assert(isSubListOf(ws filterNot (ys contains), ws diff ys), "ws_subset_ys")
val vs = List(3, 2, 2, 1)
assert(List(1, 1, 2, 3, 2, 2, 1) == (xs union vs), "xs_union_vs")
@@ -52,11 +52,11 @@ object Test_multiset {
assert(List(2, 1) == (vs intersect xs), "vs_intersect_xs")
assert(List(1) == (xs diff vs), "xs_diff_vs")
assert(List(3, 2) == (vs diff xs), "vs_diff_xs")
- assert(isSubListOf(xs -- vs, xs diff vs), "xs_subset_vs")
+ assert(isSubListOf(xs filterNot (vs contains), xs diff vs), "xs_subset_vs")
// tests adapted from Thomas Jung
assert({
- def sort(zs: List[Int]) = zs sort ( _ > _ )
+ def sort(zs: List[Int]) = zs sortWith ( _ > _ )
sort(xs intersect ys) == sort(ys intersect xs)
}, "be symmetric after sorting")
assert({
@@ -137,12 +137,12 @@ object Test2 {
val ys1 = xs1 ::: List(4)
assert(List(1, 2, 3, 4) == ys1, "check_:::")
- val ys2 = ys1 - 4
+ val ys2 = ys1 filterNot (_ == 4)
assert(xs1 == ys2, "check_-")
val n2 = (xs1 ++ ys1).length
val n3 = (xs1 ++ Nil).length
- val n4 = (xs1 ++ ((new collection.mutable.ArrayBuffer[Int]) + 0)).length
+ val n4 = (xs1 ++ ((new collection.mutable.ArrayBuffer[Int]) += 0)).length
assert(14 == n2 + n3 + n4, "check_++")
}
}
diff --git a/test/files/run/map_java_conversions.scala b/test/files/run/map_java_conversions.scala
index 4f9f8a915a..a41fae3695 100644
--- a/test/files/run/map_java_conversions.scala
+++ b/test/files/run/map_java_conversions.scala
@@ -19,7 +19,7 @@ object Test {
val concMap = new java.util.concurrent.ConcurrentHashMap[String, String]
test(concMap)
- val cmap = asConcurrentMap(concMap)
+ val cmap = asScalaConcurrentMap(concMap)
cmap.putIfAbsent("absentKey", "absentValue")
cmap.put("somekey", "somevalue")
assert(cmap.remove("somekey", "somevalue") == true)
diff --git a/test/files/run/multi-array.scala b/test/files/run/multi-array.scala
index 4f3a8d305f..36e21ae539 100644
--- a/test/files/run/multi-array.scala
+++ b/test/files/run/multi-array.scala
@@ -1,6 +1,6 @@
object Test extends App {
val a = Array(1, 2, 3)
- println(a.deepToString)
+ println(a.deep.toString)
val aaiIncomplete = new Array[Array[Array[Int]]](3)
println(aaiIncomplete(0))
@@ -9,6 +9,6 @@ object Test extends App {
println(aaiComplete.deep)
for (i <- 0 until 3; j <- 0 until 3)
aaiComplete(i)(j) = i + j
- println(aaiComplete.deepToString)
+ println(aaiComplete.deep.toString)
assert(aaiComplete.last.last == 4)
}
diff --git a/test/files/run/packrat1.scala b/test/files/run/packrat1.scala
index 3c3ea07afb..31a1ea55e5 100644
--- a/test/files/run/packrat1.scala
+++ b/test/files/run/packrat1.scala
@@ -2,7 +2,7 @@ import scala.util.parsing.combinator._
import scala.util.parsing.combinator.syntactical.StandardTokenParsers
import scala.util.parsing.input._
-import scala.util.parsing.syntax._
+import scala.util.parsing.combinator.token._
import scala.collection.mutable.HashMap
diff --git a/test/files/run/packrat2.scala b/test/files/run/packrat2.scala
index c25e5e9a85..b91a2eae46 100644
--- a/test/files/run/packrat2.scala
+++ b/test/files/run/packrat2.scala
@@ -2,7 +2,7 @@ import scala.util.parsing.combinator._
import scala.util.parsing.combinator.syntactical.StandardTokenParsers
import scala.util.parsing.input._
-import scala.util.parsing.syntax._
+import scala.util.parsing.combinator.token._
import scala.collection.mutable.HashMap
diff --git a/test/files/run/packrat3.scala b/test/files/run/packrat3.scala
index 3820f05158..8eab8ec6d0 100644
--- a/test/files/run/packrat3.scala
+++ b/test/files/run/packrat3.scala
@@ -2,7 +2,7 @@ import scala.util.parsing.combinator._
import scala.util.parsing.combinator.syntactical.StandardTokenParsers
import scala.util.parsing.input._
-import scala.util.parsing.syntax._
+import scala.util.parsing.combinator.token._
import scala.collection.mutable.HashMap
diff --git a/test/files/run/repl-suppressed-warnings.check b/test/files/run/repl-suppressed-warnings.check
index a8ab9296c0..ef9e5c1270 100644
--- a/test/files/run/repl-suppressed-warnings.check
+++ b/test/files/run/repl-suppressed-warnings.check
@@ -34,7 +34,7 @@ scala> object o {
@serializable case class Heyooooo
@deprecated("I'm an ironic deprecation warning") def f0 = 5 // where's this disappearing?
- def f1 = scala.Math.Pi // and this?
+ def f1 = Double.Epsilon // and this?
}
warning: there were 6 deprecation warnings; re-run with -deprecation for details
warning: there were 3 unchecked warnings; re-run with -unchecked for details
diff --git a/test/files/run/repl-suppressed-warnings.scala b/test/files/run/repl-suppressed-warnings.scala
index 2d96a8eb24..a79131fb2f 100644
--- a/test/files/run/repl-suppressed-warnings.scala
+++ b/test/files/run/repl-suppressed-warnings.scala
@@ -23,7 +23,7 @@ object o {
@serializable case class Heyooooo
@deprecated("I'm an ironic deprecation warning") def f0 = 5 // where's this disappearing?
- def f1 = scala.Math.Pi // and this?
+ def f1 = Double.Epsilon // and this?
}
:warnings
diff --git a/test/files/run/sort.scala b/test/files/run/sort.scala
index b89ff22f54..eea3a2d645 100644
--- a/test/files/run/sort.scala
+++ b/test/files/run/sort.scala
@@ -1,9 +1,9 @@
object Test extends App {
- println((1 to 100000).toList.sort(_<_).length)
- println(List(1, 5, 10, 3, 2).toList.sort(_<_))
- println(List(1, 5, 10, 3, 2).toList.sort(_>_))
- println(List(10).toList.sort(_<_))
- println(List(10,9).toList.sort(_<_))
- println(List[Int]().toList.sort(_<_))
+ println((1 to 100000).toList.sortWith(_<_).length)
+ println(List(1, 5, 10, 3, 2).toList.sortWith(_<_))
+ println(List(1, 5, 10, 3, 2).toList.sortWith(_>_))
+ println(List(10).toList.sortWith(_<_))
+ println(List(10,9).toList.sortWith(_<_))
+ println(List[Int]().toList.sortWith(_<_))
}
diff --git a/test/files/run/stream_length.scala b/test/files/run/stream_length.scala
index 68e9cad5ac..2808fbc495 100644
--- a/test/files/run/stream_length.scala
+++ b/test/files/run/stream_length.scala
@@ -5,7 +5,7 @@ object Test {
if (depth == 0)
Stream(bias)
else {
- Stream.concat(Stream.range(1, 100).map((x: Int) => walk(depth-1, bias + x)))
+ (Stream.iterate(1, 99)(_+1).map((x: Int) => walk(depth-1, bias + x))).flatten
}
}
diff --git a/test/files/run/t0017.scala b/test/files/run/t0017.scala
index e2a43a66ac..245cbb7e42 100644
--- a/test/files/run/t0017.scala
+++ b/test/files/run/t0017.scala
@@ -12,6 +12,6 @@ for (i <- Array.range(0, my_arr(0).length)) yield
val transposed = transpose(my_arr)
-println(transposed.deepToString)
+println(transposed.deep.toString)
}
diff --git a/test/files/run/t0421.scala b/test/files/run/t0421.scala
index 90adb31c4f..62be08c0fe 100644
--- a/test/files/run/t0421.scala
+++ b/test/files/run/t0421.scala
@@ -22,9 +22,9 @@ object Test extends App {
}
val a1 = Array(Array(0, 2, 4), Array(1, 3, 5))
- println(transpose(a1).deepMkString("[", ",", "]"))
+ println(transpose(a1).deep.mkString("[", ",", "]"))
- println(matmul(Array(Array(2, 3)), Array(Array(5), Array(7))).deepMkString("[", ",", "]"))
+ println(matmul(Array(Array(2, 3)), Array(Array(5), Array(7))).deep.mkString("[", ",", "]"))
- println(matmul(Array(Array(4)), Array(Array(6, 8))).deepMkString("[", ",", "]"))
+ println(matmul(Array(Array(4)), Array(Array(6, 8))).deep.mkString("[", ",", "]"))
}
diff --git a/test/files/run/t0677.scala b/test/files/run/t0677.scala
index 65448ed42c..131fcc24a6 100644
--- a/test/files/run/t0677.scala
+++ b/test/files/run/t0677.scala
@@ -1,7 +1,6 @@
object Test extends App {
class X[T: ClassManifest] {
- val a = new Array[Array[T]](3,4)
- val b = Array.ofDim[T](3, 4)
+ val a = Array.ofDim[T](3, 4)
}
val x = new X[String]
x.a(1)(2) = "hello"
diff --git a/test/files/run/t2417.scala b/test/files/run/t2417.scala
index 31d4c143fa..6200e33025 100644
--- a/test/files/run/t2417.scala
+++ b/test/files/run/t2417.scala
@@ -3,7 +3,7 @@ object Test {
def parallel(numThreads: Int)(block: => Unit) {
var failure: Throwable = null
- val threads = Array.fromFunction(i => new Thread {
+ val threads = Array.tabulate(numThreads)(i => new Thread {
override def run {
try {
block
@@ -11,7 +11,7 @@ object Test {
case x => failure = x
}
}
- })(numThreads)
+ })
for (t <- threads) t.start
for (t <- threads) t.join
if (failure != null) println("FAILURE: " + failure)
@@ -74,4 +74,4 @@ object Test {
testSet(5, 2, 1000000)
println()
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/t2813.2.scala b/test/files/run/t2813.2.scala
index 9a9a79da4d..f41f6451f4 100644
--- a/test/files/run/t2813.2.scala
+++ b/test/files/run/t2813.2.scala
@@ -15,20 +15,20 @@ object Test extends App {
}
def addAllOfNonCollectionWrapperAtZeroOnLinkedList() {
- val l = new LinkedList[Int] + 1 + 2
+ val l = new LinkedList[Int] += 1 += 2
l.addAll(0, List(10, 11))
assertListEquals((List(10, 11, 1, 2)), l)
}
def addAllOfCollectionWrapperAtZeroOnLinkedList() {
- val l = new LinkedList[Int] + 1 + 2
- l.addAll(0, new LinkedList[Int] + 10 + 11)
+ val l = new LinkedList[Int] += 1 += 2
+ l.addAll(0, new LinkedList[Int] += 10 += 11)
assertListEquals((List(10, 11, 1, 2)), l)
}
def addAllOfCollectionWrapperAtZeroOnEmptyLinkedList() {
val l = new LinkedList[Int]
- l.addAll(0, new LinkedList[Int] + 10 + 11)
+ l.addAll(0, new LinkedList[Int] += 10 += 11)
assertListEquals((List(10, 11)), l)
}
diff --git a/test/files/run/tailcalls.scala b/test/files/run/tailcalls.scala
index 333ec7c402..77b123f5ce 100644
--- a/test/files/run/tailcalls.scala
+++ b/test/files/run/tailcalls.scala
@@ -295,7 +295,7 @@ object Test {
while (!stop) {
try {
calibrator.f(n, n);
- if (n >= Math.MAX_INT / 2) error("calibration failure");
+ if (n >= Int.MaxValue / 2) error("calibration failure");
n = 2 * n;
} catch {
case exception: compat.Platform.StackOverflowError => stop = true
diff --git a/test/files/run/unapply.scala b/test/files/run/unapply.scala
index 85c384ab1f..0c5a70e768 100644
--- a/test/files/run/unapply.scala
+++ b/test/files/run/unapply.scala
@@ -33,7 +33,7 @@ object VarFoo {
object Foo {
def unapply(x: Any): Option[Product2[Int, String]] = x match {
- case y: Bar => Some(Tuple(y.size, y.name))
+ case y: Bar => Some(y.size, y.name)
case _ => None
}
def doMatch1(b:Bar) = b match {
@@ -69,7 +69,7 @@ object Foo {
object Mas {
object Gaz {
def unapply(x: Any): Option[Product2[Int, String]] = x match {
- case y: Baz => Some(Tuple(y.size, y.name))
+ case y: Baz => Some(y.size, y.name)
case _ => None
}
}
diff --git a/test/files/run/unittest_io.scala b/test/files/run/unittest_io.scala
index 4d2869ec3b..2cadb9b1df 100644
--- a/test/files/run/unittest_io.scala
+++ b/test/files/run/unittest_io.scala
@@ -6,20 +6,25 @@ object Test {
}
object UTF8Tests {
- import io.UTF8Codec.encode
+ def decode(ch: Int) = new String(Array(ch), 0, 1).getBytes("UTF-8")
+
def run() {
- assert(new String( encode(0x004D), "utf8") == new String(Array(0x004D.asInstanceOf[Char])))
- assert(new String( encode(0x0430), "utf8") == new String(Array(0x0430.asInstanceOf[Char])))
- assert(new String( encode(0x4E8C), "utf8") == new String(Array(0x4E8C.asInstanceOf[Char])))
- assert(new String(encode(0x10302), "utf8") == new String(Array(0xD800.asInstanceOf[Char],
+ assert(new String( decode(0x004D), "utf8") == new String(Array(0x004D.asInstanceOf[Char])))
+ assert(new String( decode(0x0430), "utf8") == new String(Array(0x0430.asInstanceOf[Char])))
+ assert(new String( decode(0x4E8C), "utf8") == new String(Array(0x4E8C.asInstanceOf[Char])))
+ assert(new String(decode(0x10302), "utf8") == new String(Array(0xD800.asInstanceOf[Char],
0xDF02.asInstanceOf[Char])))
// a client
val test = "{\"a\":\"\\u0022\"}"
- val Expected = ("a","\"")
- assert(scala.util.parsing.json.JSON.parse(test) match {
- case Some(List(Expected)) => true
- case z => Console.println(z); false
- })
+ val expected = "a" -> "\""
+
+ val parsed = scala.util.parsing.json.JSON.parseFull(test)
+ val result = parsed == Some(Map(expected))
+ if(result)
+ assert(result)
+ else {
+ Console.println(parsed); assert(result)
+ }
}
}