From 23e24fc738e2d4ad967090c375cd356cf45745ce Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 11 Nov 2012 17:22:17 +0100 Subject: Fixes #7, allow async blocks without await or with a single expression. --- .../scala/async/run/noawait/NoAwaitSpec.scala | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/test/scala/scala/async/run/noawait/NoAwaitSpec.scala (limited to 'src/test') 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) + } +} -- cgit v1.2.3