diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-05-14 17:00:54 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-05-14 17:00:54 -0700 |
commit | 487584caa97d0905df06e32c292c00fcd82a2fa3 (patch) | |
tree | a3ab7c59a1a06a6e78727ebbf7fd7aee8438ad37 /test/files/jvm | |
parent | 76b872475f0e8b847ccda1000db8f815c69deacb (diff) | |
parent | b32d294e14615bea0c062dd61350f8ab6a05b8dc (diff) | |
download | scala-487584caa97d0905df06e32c292c00fcd82a2fa3.tar.gz scala-487584caa97d0905df06e32c292c00fcd82a2fa3.tar.bz2 scala-487584caa97d0905df06e32c292c00fcd82a2fa3.zip |
Merge pull request #2502 from viktorklang/wip-SI7383-EC-prepare-in-Future-apply-2.10-√
SI-7383 - call ExecutionContext.prepare in Future.apply
Diffstat (limited to 'test/files/jvm')
-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 0efa83fbd9..ddd819c109 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]() |