aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/scala/async/run/anf
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-11-23 15:58:13 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-11-23 17:28:19 +0100
commit4c1c9fcf075d6e1e5975a04c5a2ced674716069a (patch)
tree3b507edc6b3e33bafd9fe69cfbc7dbe3ff7514b9 /src/test/scala/scala/async/run/anf
parent8658394b2cbd70db4fcb9048c347bb6b6c4db628 (diff)
downloadscala-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.scala33
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)
+ }
}