diff options
author | Philipp Haller <hallerp@gmail.com> | 2011-12-13 18:26:54 +0100 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2011-12-13 18:26:54 +0100 |
commit | 2d3731c69b69e6a3c2d68c0b18ffa803709d36cd (patch) | |
tree | 27fb0e5acfe14f96fa2ae7968241c0866a6eae04 /test/files | |
parent | 07aa03f9425afa4c91fdfc51070f3162f876abd1 (diff) | |
download | scala-2d3731c69b69e6a3c2d68c0b18ffa803709d36cd.tar.gz scala-2d3731c69b69e6a3c2d68c0b18ffa803709d36cd.tar.bz2 scala-2d3731c69b69e6a3c2d68c0b18ffa803709d36cd.zip |
Force output of exception in assert. Add tests for recover.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/jvm/scala-concurrent-tck.scala | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala index 7d73e6cf7b..bf3fa57da9 100644 --- a/test/files/jvm/scala-concurrent-tck.scala +++ b/test/files/jvm/scala-concurrent-tck.scala @@ -22,6 +22,14 @@ trait TestBase { sv.take() } + def assert(cond: => Boolean) { + try { + Predef.assert(cond) + } catch { + case e => e.printStackTrace() + } + } + } @@ -181,12 +189,35 @@ trait FutureCombinators extends TestBase { // recover: stub def testRecoverSuccess(): Unit = once { done => - done() + val cause = new RuntimeException + val f = future { + throw cause + } recover { + case re: RuntimeException => + "recovered" + } onSuccess { x => + done() + assert(x == "recovered") + } onFailure { case any => + done() + assert(false) + } } def testRecoverFailure(): Unit = once { done => - done() + val cause = new RuntimeException + val f = future { + throw cause + } recover { + case te: TimeoutException => "timeout" + } onSuccess { x => + done() + assert(false) + } onFailure { case any => + done() + assert(any == cause) + } } testMapSuccess() |