aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala')
-rw-r--r--src/test/scala/scala/async/TreeInterrogation.scala2
-rw-r--r--src/test/scala/scala/async/run/anf/AnfTransformSpec.scala33
2 files changed, 34 insertions, 1 deletions
diff --git a/src/test/scala/scala/async/TreeInterrogation.scala b/src/test/scala/scala/async/TreeInterrogation.scala
index 9e68005..16cbcf7 100644
--- a/src/test/scala/scala/async/TreeInterrogation.scala
+++ b/src/test/scala/scala/async/TreeInterrogation.scala
@@ -11,7 +11,7 @@ class TreeInterrogation {
def `a minimal set of vals are lifted to vars`() {
val cm = reflect.runtime.currentMirror
val tb = mkToolbox("-cp target/scala-2.10/classes")
- val tree = mkToolbox().parse(
+ val tree = tb.parse(
"""| import _root_.scala.async.AsyncId._
| async {
| val x = await(1)
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)
+ }
}