aboutsummaryrefslogblamecommitdiff
path: root/src/test/scala/scala/async/run/noawait/NoAwaitSpec.scala
blob: e2c69d093eb70f28339aefcae1656b75173a2695 (plain) (tree)
1
2
3
4



                                                             

































                                       
/*
 * Copyright (C) 2012 Typesafe Inc. <http://www.typesafe.com>
 */

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)
  }
}