summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-12-06 05:24:14 -0800
committerJason Zaugg <jzaugg@gmail.com>2013-12-06 05:24:14 -0800
commit6926e8d4a0f9bbb6deb29586ef7134b4efa0ca2b (patch)
treeb2078f6dd38128c5d0a295635ddfab2289d789f7 /test
parent49f7414a1ed42f00f0b5e703d01d0327eb103943 (diff)
parent2ea8aad5bc63582b563bb999c96e980597a84084 (diff)
downloadscala-6926e8d4a0f9bbb6deb29586ef7134b4efa0ca2b.tar.gz
scala-6926e8d4a0f9bbb6deb29586ef7134b4efa0ca2b.tar.bz2
scala-6926e8d4a0f9bbb6deb29586ef7134b4efa0ca2b.zip
Merge pull request #3228 from retronym/merge/2.10.x-and-pr-3209-to-master
Merge #3209 and 2.10.x to master
Diffstat (limited to 'test')
-rw-r--r--test/files/jvm/future-spec/PromiseTests.scala4
-rw-r--r--test/files/jvm/scala-concurrent-tck.scala4
-rw-r--r--test/files/presentation/ide-t1001388.check1
-rw-r--r--test/files/presentation/ide-t1001388/Test.scala28
-rw-r--r--test/files/presentation/ide-t1001388/src/a/A.scala6
-rw-r--r--test/files/presentation/t7548.check1
-rw-r--r--test/files/presentation/t7548/Test.scala17
-rw-r--r--test/files/presentation/t7548/src/Foo.scala7
-rw-r--r--test/files/presentation/t7548b.check1
-rw-r--r--test/files/presentation/t7548b/Test.scala17
-rw-r--r--test/files/presentation/t7548b/src/Foo.scala12
11 files changed, 94 insertions, 4 deletions
diff --git a/test/files/jvm/future-spec/PromiseTests.scala b/test/files/jvm/future-spec/PromiseTests.scala
index 49350586b8..12b9168c5d 100644
--- a/test/files/jvm/future-spec/PromiseTests.scala
+++ b/test/files/jvm/future-spec/PromiseTests.scala
@@ -38,10 +38,10 @@ class PromiseTests extends MinimalScalaTest {
Await.result(failure fallbackTo timedOut, defaultTimeout) mustBe ("Timedout")
Await.result(timedOut fallbackTo empty, defaultTimeout) mustBe ("Timedout")
- Await.result(failure fallbackTo failure fallbackTo timedOut, defaultTimeout) mustBe ("Timedout")
+ Await.result(otherFailure fallbackTo failure fallbackTo timedOut, defaultTimeout) mustBe ("Timedout")
intercept[RuntimeException] {
Await.result(failure fallbackTo otherFailure, defaultTimeout)
- }.getMessage mustBe ("last")
+ }.getMessage mustBe ("br0ken")
}
}
diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala
index b431f6b8f8..ce86d4aef0 100644
--- a/test/files/jvm/scala-concurrent-tck.scala
+++ b/test/files/jvm/scala-concurrent-tck.scala
@@ -344,8 +344,8 @@ def testTransformFailure(): Unit = once {
def testFallbackToFailure(): Unit = once {
done =>
val cause = new Exception
- val f = Future { sys.error("failed") }
- val g = Future { throw cause }
+ val f = Future { throw cause }
+ val g = Future { sys.error("failed") }
val h = f fallbackTo g
h onSuccess { case _ => done(false) }
diff --git a/test/files/presentation/ide-t1001388.check b/test/files/presentation/ide-t1001388.check
new file mode 100644
index 0000000000..d58f86d6c6
--- /dev/null
+++ b/test/files/presentation/ide-t1001388.check
@@ -0,0 +1 @@
+Test OK \ No newline at end of file
diff --git a/test/files/presentation/ide-t1001388/Test.scala b/test/files/presentation/ide-t1001388/Test.scala
new file mode 100644
index 0000000000..f6079cf0b2
--- /dev/null
+++ b/test/files/presentation/ide-t1001388/Test.scala
@@ -0,0 +1,28 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+import scala.reflect.internal.util.SourceFile
+import scala.tools.nsc.interactive.Response
+
+object Test extends InteractiveTest {
+ override def execute(): Unit = {
+ val sourceA = loadSourceAndWaitUntilTypechecked("A.scala")
+ checkPresent(sourceA)
+ }
+
+ private def loadSourceAndWaitUntilTypechecked(sourceName: String): SourceFile = {
+ val sourceFile = sourceFiles.find(_.file.name == sourceName).head
+ askLoadedTyped(sourceFile).get
+ /* The response to `askLoadedType` may return before `interactive.Global.waitLoadedType`
+ * fully executes. Because this test expects `waitLoadedType` is fully executed before
+ * calling `checkPresent`, with the below no-op presentation compiler request we make
+ * sure this requirement is fulfilled.
+ */
+ compiler.askForResponse(() => ()).get
+ sourceFile
+ }
+
+ private def checkPresent(source: SourceFile): Unit = compiler.getUnitOf(source) match {
+ case Some(unit) => reporter.println("Compilation Unit for " + source.file.name + " still loaded after askLoadedTyped")
+
+ case None => reporter.println("Test OK")
+ }
+}
diff --git a/test/files/presentation/ide-t1001388/src/a/A.scala b/test/files/presentation/ide-t1001388/src/a/A.scala
new file mode 100644
index 0000000000..be09097598
--- /dev/null
+++ b/test/files/presentation/ide-t1001388/src/a/A.scala
@@ -0,0 +1,6 @@
+package a
+
+object A {
+ val tagString = "foo"
+ Seq.empty[Byte].toArray.toSeq
+}
diff --git a/test/files/presentation/t7548.check b/test/files/presentation/t7548.check
new file mode 100644
index 0000000000..5bfb0d27fe
--- /dev/null
+++ b/test/files/presentation/t7548.check
@@ -0,0 +1 @@
+(x: Int)Unit
diff --git a/test/files/presentation/t7548/Test.scala b/test/files/presentation/t7548/Test.scala
new file mode 100644
index 0000000000..94a6048056
--- /dev/null
+++ b/test/files/presentation/t7548/Test.scala
@@ -0,0 +1,17 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest {
+ override protected def loadSources() { /* don't parse or typecheck sources */ }
+
+ import compiler._
+
+ override def runDefaultTests() {
+ val res = new Response[Tree]
+ val pos = compiler.rangePos(sourceFiles.head, 102,102,102)
+ compiler.askTypeAt(pos, res)
+ res.get match {
+ case Left(tree) => compiler.ask(() => reporter.println(tree.tpe))
+ case Right(ex) => reporter.println(ex)
+ }
+ }
+}
diff --git a/test/files/presentation/t7548/src/Foo.scala b/test/files/presentation/t7548/src/Foo.scala
new file mode 100644
index 0000000000..cc997f6e5f
--- /dev/null
+++ b/test/files/presentation/t7548/src/Foo.scala
@@ -0,0 +1,7 @@
+object Foo {
+ def foo(x: Int) = {}
+ def foo(x: String) = {}
+ def foo(x: Int, y: String) = {}
+
+ foo(2)
+} \ No newline at end of file
diff --git a/test/files/presentation/t7548b.check b/test/files/presentation/t7548b.check
new file mode 100644
index 0000000000..35445fedf6
--- /dev/null
+++ b/test/files/presentation/t7548b.check
@@ -0,0 +1 @@
+Foo.this.I2BI(Foo.this.I).+: (other: Foo.BI.type)Unit
diff --git a/test/files/presentation/t7548b/Test.scala b/test/files/presentation/t7548b/Test.scala
new file mode 100644
index 0000000000..0c022df839
--- /dev/null
+++ b/test/files/presentation/t7548b/Test.scala
@@ -0,0 +1,17 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest {
+ override protected def loadSources() { /* don't parse or typecheck sources */ }
+
+ import compiler._
+
+ override def runDefaultTests() {
+ val res = new Response[Tree]
+ val pos = compiler.rangePos(sourceFiles.head, 191, 191, 191) // +
+ compiler.askTypeAt(pos, res)
+ res.get match {
+ case Left(tree) => compiler.ask(() => reporter.println(s"$tree: ${tree.tpe}"))
+ case Right(ex) => reporter.println(ex)
+ }
+ }
+}
diff --git a/test/files/presentation/t7548b/src/Foo.scala b/test/files/presentation/t7548b/src/Foo.scala
new file mode 100644
index 0000000000..5cf0a4ef4e
--- /dev/null
+++ b/test/files/presentation/t7548b/src/Foo.scala
@@ -0,0 +1,12 @@
+import language._
+
+object Foo {
+ object I {
+ def +(other: I.type) : Unit = ()
+ }
+ object BI {
+ def +(other: BI.type): Unit = ()
+ }
+ implicit def I2BI(i: I.type): BI.type = BI
+ I.+(BI)
+}