aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/scala/async/run/noawait/NoAwaitSpec.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-11-11 17:22:17 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-11-11 17:22:17 +0100
commit23e24fc738e2d4ad967090c375cd356cf45745ce (patch)
treec2fff138f04d76ec990654e12ef99c04d46a06ab /src/test/scala/scala/async/run/noawait/NoAwaitSpec.scala
parent412682afb20def5e50533c300439828078d5e657 (diff)
downloadscala-async-23e24fc738e2d4ad967090c375cd356cf45745ce.tar.gz
scala-async-23e24fc738e2d4ad967090c375cd356cf45745ce.tar.bz2
scala-async-23e24fc738e2d4ad967090c375cd356cf45745ce.zip
Fixes #7, allow async blocks without await or with a single expression.
Diffstat (limited to 'src/test/scala/scala/async/run/noawait/NoAwaitSpec.scala')
-rw-r--r--src/test/scala/scala/async/run/noawait/NoAwaitSpec.scala34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/scala/scala/async/run/noawait/NoAwaitSpec.scala b/src/test/scala/scala/async/run/noawait/NoAwaitSpec.scala
new file mode 100644
index 0000000..90be946
--- /dev/null
+++ b/src/test/scala/scala/async/run/noawait/NoAwaitSpec.scala
@@ -0,0 +1,34 @@
+package scala.async
+package run
+package noawait
+
+import AsyncId._
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(classOf[JUnit4])
+class NoAwaitSpec {
+ @Test
+ def `async block without await`() {
+ def foo = 1
+ async {
+ foo
+ foo
+ } mustBe (foo)
+ }
+
+ @Test
+ def `async block without await 2`() {
+ async {
+ def x = 0
+ if (x > 0) 0 else 1
+ } mustBe (1)
+ }
+
+ @Test
+ def `async expr without await`() {
+ def foo = 1
+ async(foo) mustBe (foo)
+ }
+}