aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala/scala/async/run/anf/AnfTransformSpec.scala')
-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)
+ }
}