summaryrefslogtreecommitdiff
path: root/test/files/jvm
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/jvm')
-rw-r--r--test/files/jvm/daemon-actor-termination.scala2
-rw-r--r--test/files/jvm/future-spec/FutureTests.scala9
-rw-r--r--test/files/jvm/interpreter.check2
-rw-r--r--test/files/jvm/interpreter.scala2
-rw-r--r--test/files/jvm/try-type-tests.scala264
5 files changed, 137 insertions, 142 deletions
diff --git a/test/files/jvm/daemon-actor-termination.scala b/test/files/jvm/daemon-actor-termination.scala
index 40acd8583e..9bac6340ba 100644
--- a/test/files/jvm/daemon-actor-termination.scala
+++ b/test/files/jvm/daemon-actor-termination.scala
@@ -11,7 +11,7 @@ object Test {
react {
case 'hello =>
println("MSG1")
- reply()
+ reply(())
react {
case 'bye =>
println("done")
diff --git a/test/files/jvm/future-spec/FutureTests.scala b/test/files/jvm/future-spec/FutureTests.scala
index cfdcc31ac5..a290af9cd3 100644
--- a/test/files/jvm/future-spec/FutureTests.scala
+++ b/test/files/jvm/future-spec/FutureTests.scala
@@ -1,6 +1,3 @@
-
-
-
import scala.concurrent._
import scala.concurrent.duration._
import scala.concurrent.duration.Duration.Inf
@@ -518,7 +515,7 @@ class FutureTests extends MinimalScalaTest {
}
"should not deadlock with nested await (ticket 1313)" in {
- val simple = Future() map {
+ val simple = Future(()) map {
_ =>
val unit = Future(())
val umap = unit map { _ => () }
@@ -527,7 +524,7 @@ class FutureTests extends MinimalScalaTest {
Await.ready(simple, Inf).isCompleted mustBe (true)
val l1, l2 = new TestLatch
- val complex = Future() map {
+ val complex = Future(()) map {
_ =>
blocking {
val nested = Future(())
@@ -549,5 +546,3 @@ class FutureTests extends MinimalScalaTest {
}
}
-
-
diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check
index 6e5fada381..b55ecc10e6 100644
--- a/test/files/jvm/interpreter.check
+++ b/test/files/jvm/interpreter.check
@@ -58,7 +58,7 @@ t1513: Array[Null] = Array(null)
scala> // ambiguous toString problem from #547
-scala> val atom = new scala.xml.Atom()
+scala> val atom = new scala.xml.Atom(())
atom: scala.xml.Atom[Unit] = ()
scala> // overriding toString problem from #1404
diff --git a/test/files/jvm/interpreter.scala b/test/files/jvm/interpreter.scala
index bd1851053f..c68c064c31 100644
--- a/test/files/jvm/interpreter.scala
+++ b/test/files/jvm/interpreter.scala
@@ -25,7 +25,7 @@ println("hello")
// ticket #1513
val t1513 = Array(null)
// ambiguous toString problem from #547
-val atom = new scala.xml.Atom()
+val atom = new scala.xml.Atom(())
// overriding toString problem from #1404
class S(override val toString : String)
val fish = new S("fish")
diff --git a/test/files/jvm/try-type-tests.scala b/test/files/jvm/try-type-tests.scala
index e5e53ee737..962afbd30f 100644
--- a/test/files/jvm/try-type-tests.scala
+++ b/test/files/jvm/try-type-tests.scala
@@ -3,139 +3,139 @@ import scala.util.{Try, Success, Failure}
// tests the basic combinators on Try
trait TryStandard {
- def testForeachSuccess(): Unit = {
- val t = Success(1)
- var res = 0
- t.foreach(x => res = x * 10)
- assert(res == 10)
- }
-
- def testForeachFailure(): Unit = {
- val t = Failure(new Exception("foo"))
- t.foreach(x => assert(false))
- }
-
- def testFlatMapSuccess(): Unit = {
- val t = Success(1)
- val n = t.flatMap(x => Try(x * 10))
- assert(n.get == 10)
- }
-
- def testFlatMapFailure(): Unit = {
- val t = Failure(new Exception("foo"))
- val n = t.flatMap{ x => assert(false); Try() }
- }
-
- def testMapSuccess(): Unit = {
- val t = Success(1)
- val n = t.map(x => x * 10)
- assert(n.get == 10)
- }
-
- def testMapFailure(): Unit = {
- val t = Failure(new Exception("foo"))
- val n = t.map(x => assert(false))
- }
-
- def testFilterSuccessTrue(): Unit = {
- val t = Success(1)
- val n = t.filter(x => x > 0)
- assert(n.get == 1)
- }
-
- def testFilterSuccessFalse(): Unit = {
- val t = Success(1)
- val n = t.filter(x => x < 0)
- n match {
- case Success(v) => assert(false)
- case Failure(e: NoSuchElementException) => assert(true)
+ def testForeachSuccess(): Unit = {
+ val t = Success(1)
+ var res = 0
+ t.foreach(x => res = x * 10)
+ assert(res == 10)
+ }
+
+ def testForeachFailure(): Unit = {
+ val t = Failure(new Exception("foo"))
+ t.foreach(x => assert(false))
+ }
+
+ def testFlatMapSuccess(): Unit = {
+ val t = Success(1)
+ val n = t.flatMap(x => Try(x * 10))
+ assert(n.get == 10)
+ }
+
+ def testFlatMapFailure(): Unit = {
+ val t = Failure(new Exception("foo"))
+ val n = t.flatMap{ x => assert(false); Try(()) }
+ }
+
+ def testMapSuccess(): Unit = {
+ val t = Success(1)
+ val n = t.map(x => x * 10)
+ assert(n.get == 10)
+ }
+
+ def testMapFailure(): Unit = {
+ val t = Failure(new Exception("foo"))
+ val n = t.map(x => assert(false))
+ }
+
+ def testFilterSuccessTrue(): Unit = {
+ val t = Success(1)
+ val n = t.filter(x => x > 0)
+ assert(n.get == 1)
+ }
+
+ def testFilterSuccessFalse(): Unit = {
+ val t = Success(1)
+ val n = t.filter(x => x < 0)
+ n match {
+ case Success(v) => assert(false)
+ case Failure(e: NoSuchElementException) => assert(true)
case _ => assert(false)
- }
- }
-
- def testFilterFailure(): Unit = {
- val t = Failure(new Exception("foo"))
- val n = t.filter{ x => assert(false); true }
- }
-
- def testRescueSuccess(): Unit = {
- val t = Success(1)
- t.recoverWith{ case x => assert(false); Try() }
- }
-
- def testRescueFailure(): Unit = {
- val t = Failure(new Exception("foo"))
- val n = t.recoverWith{ case x => Try(1) }
- assert(n.get == 1)
- }
-
- def testRecoverSuccess(): Unit = {
- val t = Success(1)
- t.recover{ case x => assert(false); 99 }
- }
-
- def testRecoverFailure(): Unit = {
- val t = Failure(new Exception("foo"))
- val n = t.recover{ case x => 1 }
- assert(n.get == 1)
- }
-
- def testFlattenSuccess(): Unit = {
- val f = Failure(new Exception("foo"))
- val t = Success(f)
- assert(t.flatten == f)
- }
-
- def testFailedSuccess(): Unit = {
- val t = Success(1)
- val n = t.failed
- n match {
- case Failure(e: UnsupportedOperationException) => assert(true)
- case _ => assert(false)
- }
- }
-
- def testFailedFailure(): Unit = {
- val t = Failure(new Exception("foo"))
- val n = t.failed
- n match {
- case Success(e: Exception) => assert(true)
- case _ => assert(false)
- }
- }
-
- def testSuccessTransform(): Unit = {
- val s = Success(1)
- val succ = (x: Int) => Success(x * 10)
- val fail = (x: Throwable) => Success(0)
- assert(s.transform(succ, fail).get == 10)
- }
-
- def testFailureTransform(): Unit = {
- val f = Failure(new Exception("foo"))
- val succ = (x: Int) => Success(x * 10)
- val fail = (x: Throwable) => Success(0)
- assert(f.transform(succ, fail).get == 0)
- }
-
- testForeachSuccess()
- testForeachFailure()
- testFlatMapSuccess()
- testFlatMapFailure()
- testMapSuccess()
- testMapFailure()
- testFilterSuccessTrue()
- testFilterSuccessFalse()
- testFilterFailure()
- testRescueSuccess()
- testRescueFailure()
- testRecoverSuccess()
- testRecoverFailure()
- testFlattenSuccess()
- testFailedSuccess()
- testFailedFailure()
- testSuccessTransform()
- testFailureTransform()
+ }
+ }
+
+ def testFilterFailure(): Unit = {
+ val t = Failure(new Exception("foo"))
+ val n = t.filter{ x => assert(false); true }
+ }
+
+ def testRescueSuccess(): Unit = {
+ val t = Success(1)
+ t.recoverWith{ case x => assert(false); Try(()) }
+ }
+
+ def testRescueFailure(): Unit = {
+ val t = Failure(new Exception("foo"))
+ val n = t.recoverWith{ case x => Try(1) }
+ assert(n.get == 1)
+ }
+
+ def testRecoverSuccess(): Unit = {
+ val t = Success(1)
+ t.recover{ case x => assert(false); 99 }
+ }
+
+ def testRecoverFailure(): Unit = {
+ val t = Failure(new Exception("foo"))
+ val n = t.recover{ case x => 1 }
+ assert(n.get == 1)
+ }
+
+ def testFlattenSuccess(): Unit = {
+ val f = Failure(new Exception("foo"))
+ val t = Success(f)
+ assert(t.flatten == f)
+ }
+
+ def testFailedSuccess(): Unit = {
+ val t = Success(1)
+ val n = t.failed
+ n match {
+ case Failure(e: UnsupportedOperationException) => assert(true)
+ case _ => assert(false)
+ }
+ }
+
+ def testFailedFailure(): Unit = {
+ val t = Failure(new Exception("foo"))
+ val n = t.failed
+ n match {
+ case Success(e: Exception) => assert(true)
+ case _ => assert(false)
+ }
+ }
+
+ def testSuccessTransform(): Unit = {
+ val s = Success(1)
+ val succ = (x: Int) => Success(x * 10)
+ val fail = (x: Throwable) => Success(0)
+ assert(s.transform(succ, fail).get == 10)
+ }
+
+ def testFailureTransform(): Unit = {
+ val f = Failure(new Exception("foo"))
+ val succ = (x: Int) => Success(x * 10)
+ val fail = (x: Throwable) => Success(0)
+ assert(f.transform(succ, fail).get == 0)
+ }
+
+ testForeachSuccess()
+ testForeachFailure()
+ testFlatMapSuccess()
+ testFlatMapFailure()
+ testMapSuccess()
+ testMapFailure()
+ testFilterSuccessTrue()
+ testFilterSuccessFalse()
+ testFilterFailure()
+ testRescueSuccess()
+ testRescueFailure()
+ testRecoverSuccess()
+ testRecoverFailure()
+ testFlattenSuccess()
+ testFailedSuccess()
+ testFailedFailure()
+ testSuccessTransform()
+ testFailureTransform()
}
object Test