diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-11-23 15:58:13 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-11-23 17:28:19 +0100 |
commit | 4c1c9fcf075d6e1e5975a04c5a2ced674716069a (patch) | |
tree | 3b507edc6b3e33bafd9fe69cfbc7dbe3ff7514b9 /src/test/scala/scala/async/run/anf | |
parent | 8658394b2cbd70db4fcb9048c347bb6b6c4db628 (diff) | |
download | scala-async-4c1c9fcf075d6e1e5975a04c5a2ced674716069a.tar.gz scala-async-4c1c9fcf075d6e1e5975a04c5a2ced674716069a.tar.bz2 scala-async-4c1c9fcf075d6e1e5975a04c5a2ced674716069a.zip |
Fix #31, Unfinished ANF transform
Prepend {(); ... } before starting the ANF transform.
Add tracing to the anf/inline transform.
Also enables and addresses SIP-18 warnings.
Diffstat (limited to 'src/test/scala/scala/async/run/anf')
-rw-r--r-- | src/test/scala/scala/async/run/anf/AnfTransformSpec.scala | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala b/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala index 872e44d..8bdb80f 100644 --- a/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala +++ b/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala @@ -172,4 +172,37 @@ class AnfTransformSpec { } result mustBe (103) } + + @Test + def nestedAwaitAsBareExpression() { + import ExecutionContext.Implicits.global + import _root_.scala.async.AsyncId.{async, await} + val result = async { + await(await("").isEmpty) + } + result mustBe (true) + } + + @Test + def nestedAwaitInBlock() { + import ExecutionContext.Implicits.global + import _root_.scala.async.AsyncId.{async, await} + val result = async { + () + await(await("").isEmpty) + } + result mustBe (true) + } + + @Test + def nestedAwaitInIf() { + import ExecutionContext.Implicits.global + import _root_.scala.async.AsyncId.{async, await} + val result = async { + if ("".isEmpty) + await(await("").isEmpty) + else 0 + } + result mustBe (true) + } } |