diff options
Diffstat (limited to 'test/files/jvm/future-spec')
-rw-r--r-- | test/files/jvm/future-spec/FutureTests.scala | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/files/jvm/future-spec/FutureTests.scala b/test/files/jvm/future-spec/FutureTests.scala index 01c9cf82ba..7deb4929d4 100644 --- a/test/files/jvm/future-spec/FutureTests.scala +++ b/test/files/jvm/future-spec/FutureTests.scala @@ -71,6 +71,25 @@ object FutureTests extends MinimalScalaTest { } } + "The Future companion object" should { + "call ExecutionContext.prepare on apply" in { + val p = Promise[Boolean]() + val ec = new ExecutionContext { + val delegate = ExecutionContext.global + override def prepare(): ExecutionContext = { + p.success(true) + delegate.prepare + } + override def execute(r: Runnable) = delegate.execute(r) + override def reportFailure(t: Throwable): Unit = delegate.reportFailure(t) + } + + val f = Future("foo")(ec) + Await.result(f, defaultTimeout) mustBe ("foo") + Await.result(p.future, defaultTimeout) mustBe (true) + } + } + "The default ExecutionContext" should { "report uncaught exceptions" in { val p = Promise[Throwable]() |