diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/jvm/scala-concurrent-tck-akka.scala | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/test/files/jvm/scala-concurrent-tck-akka.scala b/test/files/jvm/scala-concurrent-tck-akka.scala index 9fd709d05e..1ef248bda3 100644 --- a/test/files/jvm/scala-concurrent-tck-akka.scala +++ b/test/files/jvm/scala-concurrent-tck-akka.scala @@ -4,6 +4,12 @@ import akka.dispatch.{ Future => future, Promise => promise } +import akka.dispatch.Await.{result => await} + +// Duration required for await +import akka.util.Duration +import java.util.concurrent.TimeUnit +import TimeUnit._ import scala.concurrent.{ TimeoutException, @@ -128,10 +134,10 @@ trait FutureCallbacks extends TestBase { testOnSuccessWhenCompleted() testOnSuccessWhenFailed() testOnFailure() - testOnFailureWhenSpecialThrowable(5, new Error) - testOnFailureWhenSpecialThrowable(6, new scala.util.control.ControlThrowable { }) - testOnFailureWhenSpecialThrowable(7, new InterruptedException) - testOnFailureWhenTimeoutException() +// testOnFailureWhenSpecialThrowable(5, new Error) +// testOnFailureWhenSpecialThrowable(6, new scala.util.control.ControlThrowable { }) +// testOnFailureWhenSpecialThrowable(7, new InterruptedException) +// testOnFailureWhenTimeoutException() } @@ -291,7 +297,31 @@ trait FutureProjections extends TestBase { trait Blocking extends TestBase { - // TODO + def testAwaitSuccess(): Unit = once { + done => + val f = future { 0 } + await(f, Duration(500, "ms")) + done() + } + + def testAwaitFailure(): Unit = once { + done => + val cause = new RuntimeException + val f = future { + throw cause + } + try { + await(f, Duration(500, "ms")) + assert(false) + } catch { + case t => + assert(t == cause) + done() + } + } + + testAwaitSuccess() + testAwaitFailure() } @@ -330,9 +360,10 @@ with FutureCallbacks with FutureCombinators /*with FutureProjections*/ /*with Promises*/ +with Blocking with Exceptions { - + System.exit(0) } |