summaryrefslogtreecommitdiff
path: root/test/files/jvm/scala-concurrent-tck.scala
diff options
context:
space:
mode:
authorHeather Miller <heather.miller@epfl.ch>2012-08-04 21:55:35 +0200
committerHeather Miller <heather.miller@epfl.ch>2012-08-04 21:55:35 +0200
commit3cb0e784a05db7d0b542cec9bf4c5fbf3772a6cf (patch)
tree36c1a6040e0f0aa6e64c0eef6fb55bea61bf4141 /test/files/jvm/scala-concurrent-tck.scala
parentab63cca87f68d80aff0ff6cd83ecd85b9e1d0c7a (diff)
downloadscala-3cb0e784a05db7d0b542cec9bf4c5fbf3772a6cf.tar.gz
scala-3cb0e784a05db7d0b542cec9bf4c5fbf3772a6cf.tar.bz2
scala-3cb0e784a05db7d0b542cec9bf4c5fbf3772a6cf.zip
Basing Futures on Try instead of Either
Diffstat (limited to 'test/files/jvm/scala-concurrent-tck.scala')
-rw-r--r--test/files/jvm/scala-concurrent-tck.scala91
1 files changed, 6 insertions, 85 deletions
diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala
index 43d4c9dc71..36ab910593 100644
--- a/test/files/jvm/scala-concurrent-tck.scala
+++ b/test/files/jvm/scala-concurrent-tck.scala
@@ -601,10 +601,10 @@ trait FutureProjections extends TestBase {
throw cause
}
f.failed onComplete {
- case Right(t) =>
+ case Success(t) =>
assert(t == cause)
done()
- case Left(t) =>
+ case Failure(t) =>
assert(false)
}
}
@@ -626,9 +626,9 @@ trait FutureProjections extends TestBase {
done =>
val f = future { 0 }
f.failed onComplete {
- case Right(t) =>
+ case Success(t) =>
assert(false)
- case Left(t) =>
+ case Failure(t) =>
assert(t.isInstanceOf[NoSuchElementException])
done()
}
@@ -803,81 +803,6 @@ trait Exceptions extends TestBase {
}
-// trait TryEitherExtractor extends TestBase {
-
-// import scala.util.{Try, Success, Failure}
-
-// def testSuccessMatch(): Unit = once {
-// done =>
-// val thisIsASuccess = Success(42)
-// thisIsASuccess match {
-// case Success(v) =>
-// done()
-// assert(v == 42)
-// case Failure(e) =>
-// done()
-// assert(false)
-// case other =>
-// done()
-// assert(false)
-// }
-// }
-
-// def testRightMatch(): Unit = once {
-// done =>
-// val thisIsNotASuccess: Right[Throwable, Int] = Right(43)
-// thisIsNotASuccess match {
-// case Success(v) =>
-// done()
-// assert(v == 43)
-// case Failure(e) =>
-// done()
-// assert(false)
-// case other =>
-// done()
-// assert(false)
-// }
-// }
-
-// def testFailureMatch(): Unit = once {
-// done =>
-// val thisIsAFailure = Failure(new Exception("I'm an exception"))
-// thisIsAFailure match {
-// case Success(v) =>
-// done()
-// assert(false)
-// case Failure(e) =>
-// done()
-// assert(e.getMessage == "I'm an exception")
-// case other =>
-// done()
-// assert(false)
-// }
-// }
-
-// def testLeftMatch(): Unit = once {
-// done =>
-// val thisIsNotAFailure: Left[Throwable, Int] = Left(new Exception("I'm an exception"))
-// thisIsNotAFailure match {
-// case Success(v) =>
-// done()
-// assert(false)
-// case Failure(e) =>
-// done()
-// assert(e.getMessage == "I'm an exception")
-// case other =>
-// done()
-// assert(false)
-// }
-
-// }
-
-// testSuccessMatch()
-// testRightMatch()
-// testFailureMatch()
-// testLeftMatch()
-// }
-
trait CustomExecutionContext extends TestBase {
import scala.concurrent.{ ExecutionContext, Awaitable }
@@ -975,13 +900,13 @@ trait CustomExecutionContext extends TestBase {
} flatMap { x =>
Promise.successful(x + 1).future.map(addOne).map(addOne)
} onComplete {
- case Left(t) =>
+ case Failure(t) =>
try {
throw new AssertionError("error in test: " + t.getMessage, t)
} finally {
done()
}
- case Right(x) =>
+ case Success(x) =>
assertEC()
assert(x == 14)
done()
@@ -1009,12 +934,8 @@ with FutureProjections
with Promises
with BlockContexts
with Exceptions
-// with TryEitherExtractor
with CustomExecutionContext
{
System.exit(0)
}
-
-
-