diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-11-07 15:27:40 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-11-07 15:59:54 +0100 |
commit | 10f3c8db6163ebe3196173c1d87e69c1fb6a3a65 (patch) | |
tree | b0043bf3feaea28eef36ed9548fa360213b1fd72 /src/test/scala/scala/async | |
parent | 6a2b940ac6b7e511270079e1b6278c844a57f5d1 (diff) | |
download | scala-async-10f3c8db6163ebe3196173c1d87e69c1fb6a3a65.tar.gz scala-async-10f3c8db6163ebe3196173c1d87e69c1fb6a3a65.tar.bz2 scala-async-10f3c8db6163ebe3196173c1d87e69c1fb6a3a65.zip |
Minimize the public API
- Remove the CPS fallback version of async. That was not intended
to be part of 1.0.
- Lookup the await method beside the macro, rather than requiring
all calls to go to AsyncBase.await.
- Create a minimal version of Async that just contains await/async
and delegates to the macro implementation in internal._
- Add scaladoc.
Diffstat (limited to 'src/test/scala/scala/async')
-rw-r--r-- | src/test/scala/scala/async/run/cps/CPSSpec.scala | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/test/scala/scala/async/run/cps/CPSSpec.scala b/src/test/scala/scala/async/run/cps/CPSSpec.scala deleted file mode 100644 index 9476b22..0000000 --- a/src/test/scala/scala/async/run/cps/CPSSpec.scala +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2012 Typesafe Inc. <http://www.typesafe.com> - */ - -package scala.async -package run -package cps - -import scala.concurrent.{Future, Promise, ExecutionContext, future, Await} -import scala.concurrent.duration._ -import scala.async.continuations.CPSBasedAsync._ -import scala.util.continuations._ - -import org.junit.Test - -class CPSSpec { - - import ExecutionContext.Implicits.global - - def m1(y: Int): Future[Int] = async { - val f = future { y + 2 } - val f2 = future { y + 3 } - val x1 = await(f) - val x2 = await(f2) - x1 + x2 - } - - def m2(y: Int): Future[Int] = async { - val f = future { y + 2 } - val res = await(f) - if (y > 0) res + 2 - else res - 2 - } - - @Test - def testCPSFallback() { - val fut1 = m1(10) - val res1 = Await.result(fut1, 2.seconds) - assert(res1 == 25, s"expected 25, got $res1") - - val fut2 = m2(10) - val res2 = Await.result(fut2, 2.seconds) - assert(res2 == 14, s"expected 14, got $res2") - } - -} |