aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/scala/async/run/noawait/NoAwaitSpec.scala
blob: 90be946894a1c1a2b38477bb562c4bcf9e7dcfa8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)
  }
}