aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-11-22 13:33:09 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-11-22 13:33:09 +0100
commit8e4a8ecdff955c4faa1dec344a2b93543ffe7d45 (patch)
tree8733f9b854baa83194b1688fa30ed5fc90fd249c /src/test
parenta30ba69777a83d77b3924081f8b70d76c4a3ed59 (diff)
downloadscala-async-8e4a8ecdff955c4faa1dec344a2b93543ffe7d45.tar.gz
scala-async-8e4a8ecdff955c4faa1dec344a2b93543ffe7d45.tar.bz2
scala-async-8e4a8ecdff955c4faa1dec344a2b93543ffe7d45.zip
Cleanups and docs.
- Move now-working duplicate definition tests from `neg` to `run`. - Renames and small code beautification around the var lifting analysis
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/scala/async/neg/AnfTransformNegSpec.scala59
-rw-r--r--src/test/scala/scala/async/run/anf/AnfTransformSpec.scala32
2 files changed, 32 insertions, 59 deletions
diff --git a/src/test/scala/scala/async/neg/AnfTransformNegSpec.scala b/src/test/scala/scala/async/neg/AnfTransformNegSpec.scala
deleted file mode 100644
index 0678429..0000000
--- a/src/test/scala/scala/async/neg/AnfTransformNegSpec.scala
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Copyright (C) 2012 Typesafe Inc. <http://www.typesafe.com>
- */
-package scala.async
-package neg
-
-import org.junit.runner.RunWith
-import org.junit.runners.JUnit4
-import org.junit.{Ignore, Test}
-
-@RunWith(classOf[JUnit4])
-class AnfTransformNegSpec {
-
- @Test
- @Ignore
- def `inlining block produces duplicate definition`() {
- expectError("x is already defined as value x", "-deprecation -Xfatal-warnings") {
- """
- | import scala.concurrent.ExecutionContext.Implicits.global
- | import scala.concurrent.Future
- | import scala.async.Async._
- |
- | async {
- | val f = Future { 12 }
- | val x = await(f)
- |
- | {
- | val x = 42
- | println(x)
- | }
- |
- | x
- | }
- """.stripMargin
- }
- }
-
- @Test
- @Ignore
- def `inlining block in tail position produces duplicate definition`() {
- expectError("x is already defined as value x", "-deprecation -Xfatal-warnings") {
- """
- | import scala.concurrent.ExecutionContext.Implicits.global
- | import scala.concurrent.Future
- | import scala.async.Async._
- |
- | async {
- | val f = Future { 12 }
- | val x = await(f)
- |
- | {
- | val x = 42
- | x
- | }
- | }
- """.stripMargin
- }
- }
-}
diff --git a/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala b/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala
index f2fc2d7..0abb937 100644
--- a/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala
+++ b/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala
@@ -111,4 +111,36 @@ class AnfTransformSpec {
Await.result(fut, 2 seconds)
State.result mustBe (14)
}
+
+ @Test
+ def `inlining block produces duplicate definition`() {
+ import scala.async.AsyncId
+
+ AsyncId.async {
+ val f = 12
+ val x = AsyncId.await(f)
+
+ {
+ val x = 42
+ println(x)
+ }
+
+ x
+ }
+ }
+ @Test
+ def `inlining block in tail position produces duplicate definition`() {
+ import scala.async.AsyncId
+
+ AsyncId.async {
+ val f = 12
+ val x = AsyncId.await(f)
+
+ {
+ val x = 42 // TODO should we rename the symbols when we collapse them into the same scope?
+ x
+ }
+ } mustBe (42)
+
+ }
}