summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
Diffstat (limited to 'test/files')
-rw-r--r--test/files/jvm/future-spec/FutureTests.scala2
-rw-r--r--test/files/jvm/future-spec/PromiseTests.scala2
-rw-r--r--test/files/jvm/scala-concurrent-tck.scala96
-rw-r--r--test/files/neg/t5544.check4
-rw-r--r--test/files/neg/t5544/Api_1.scala8
-rw-r--r--test/files/neg/t5544/Test_2.scala3
-rw-r--r--test/files/neg/t5801.check22
-rw-r--r--test/files/neg/t5801.scala16
-rw-r--r--test/files/run/t3488.check2
-rw-r--r--test/files/run/t3488.scala6
-rw-r--r--test/files/run/t4138.check2
-rw-r--r--test/files/run/t4138.scala6
-rw-r--r--test/files/run/t4461.check6
-rw-r--r--test/files/run/t4461.scala4
-rw-r--r--test/files/run/t5544.check1
-rw-r--r--test/files/run/t5544/Api_1.scala8
-rw-r--r--test/files/run/t5544/Test_2.scala3
17 files changed, 178 insertions, 13 deletions
diff --git a/test/files/jvm/future-spec/FutureTests.scala b/test/files/jvm/future-spec/FutureTests.scala
index 9a9cf951bb..e5e01a5954 100644
--- a/test/files/jvm/future-spec/FutureTests.scala
+++ b/test/files/jvm/future-spec/FutureTests.scala
@@ -19,7 +19,7 @@ object FutureTests extends MinimalScalaTest {
case "NoReply" => Promise[String]().future
}
- val defaultTimeout = Inf
+ val defaultTimeout = 5 seconds
/* future specification */
diff --git a/test/files/jvm/future-spec/PromiseTests.scala b/test/files/jvm/future-spec/PromiseTests.scala
index 6016746a23..bf9d9b39d7 100644
--- a/test/files/jvm/future-spec/PromiseTests.scala
+++ b/test/files/jvm/future-spec/PromiseTests.scala
@@ -133,7 +133,7 @@ object PromiseTests extends MinimalScalaTest {
(future, result) =>
intercept[NoSuchElementException] {
Await.result(future.failed, defaultTimeout)
- }.getMessage mustBe ("Future.failed not completed with a throwable. Instead completed with: " + result)
+ }.getMessage mustBe ("Future.failed not completed with a throwable.")
}
}
diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala
index fce1a25bb6..86655ad89c 100644
--- a/test/files/jvm/scala-concurrent-tck.scala
+++ b/test/files/jvm/scala-concurrent-tck.scala
@@ -182,6 +182,72 @@ trait FutureCombinators extends TestBase {
}
}
+ def testMapSuccessPF(): Unit = once {
+ done =>
+ val f = future { 5 }
+ val g = f map { case r => "result: " + r }
+ g onSuccess {
+ case s =>
+ done()
+ assert(s == "result: 5")
+ }
+ g onFailure {
+ case _ =>
+ done()
+ assert(false)
+ }
+ }
+
+ def testTransformSuccess(): Unit = once {
+ done =>
+ val f = future { 5 }
+ val g = f.transform(r => "result: " + r, identity)
+ g onSuccess {
+ case s =>
+ done()
+ assert(s == "result: 5")
+ }
+ g onFailure {
+ case _ =>
+ done()
+ assert(false)
+ }
+ }
+
+ def testTransformSuccessPF(): Unit = once {
+ done =>
+ val f = future { 5 }
+ val g = f.transform( { case r => "result: " + r }, identity)
+ g onSuccess {
+ case s =>
+ done()
+ assert(s == "result: 5")
+ }
+ g onFailure {
+ case _ =>
+ done()
+ assert(false)
+ }
+ }
+
+ def testFoldFailure(): Unit = once {
+ done =>
+ val f = future {
+ throw new Exception("exception message")
+ }
+ val g = f.transform(r => "result: " + r, identity)
+ g onSuccess {
+ case _ =>
+ done()
+ assert(false)
+ }
+ g onFailure {
+ case t =>
+ done()
+ assert(t.getMessage() == "exception message")
+ }
+ }
+
def testFlatMapSuccess(): Unit = once {
done =>
val f = future { 5 }
@@ -340,14 +406,17 @@ trait FutureCombinators extends TestBase {
} recover {
case re: RuntimeException =>
"recovered"
- } onSuccess {
+ }
+ f onSuccess {
case x =>
done()
assert(x == "recovered")
- } onFailure { case any =>
+ }
+ f onFailure { case any =>
done()
assert(false)
}
+ f
}
def testRecoverFailure(): Unit = once {
@@ -357,11 +426,13 @@ trait FutureCombinators extends TestBase {
throw cause
} recover {
case te: TimeoutException => "timeout"
- } onSuccess {
+ }
+ f onSuccess {
case x =>
done()
assert(false)
- } onFailure { case any =>
+ }
+ f onFailure { case any =>
done()
assert(any == cause)
}
@@ -375,11 +446,13 @@ trait FutureCombinators extends TestBase {
} recoverWith {
case re: RuntimeException =>
future { "recovered" }
- } onSuccess {
+ }
+ f onSuccess {
case x =>
done()
assert(x == "recovered")
- } onFailure { case any =>
+ }
+ f onFailure { case any =>
done()
assert(false)
}
@@ -393,11 +466,13 @@ trait FutureCombinators extends TestBase {
} recoverWith {
case te: TimeoutException =>
future { "timeout" }
- } onSuccess {
+ }
+ f onSuccess {
case x =>
done()
assert(false)
- } onFailure { case any =>
+ }
+ f onFailure { case any =>
done()
assert(any == cause)
}
@@ -635,11 +710,12 @@ trait Promises extends TestBase {
val p = promise[Int]()
val f = p.future
- f.onSuccess {
+ f onSuccess {
case x =>
done()
assert(x == 5)
- } onFailure {
+ }
+ f onFailure {
case any =>
done()
assert(false)
diff --git a/test/files/neg/t5544.check b/test/files/neg/t5544.check
new file mode 100644
index 0000000000..d4113935a3
--- /dev/null
+++ b/test/files/neg/t5544.check
@@ -0,0 +1,4 @@
+Test_2.scala:2: error: value baz is not a member of object Api
+ Api.baz
+ ^
+one error found
diff --git a/test/files/neg/t5544/Api_1.scala b/test/files/neg/t5544/Api_1.scala
new file mode 100644
index 0000000000..77637f440a
--- /dev/null
+++ b/test/files/neg/t5544/Api_1.scala
@@ -0,0 +1,8 @@
+import scala.annotation.StaticAnnotation
+
+class ann(val bar: Any) extends StaticAnnotation
+
+object Api {
+ @ann({def baz = "baz!!"})
+ def foo = println("foo")
+}
diff --git a/test/files/neg/t5544/Test_2.scala b/test/files/neg/t5544/Test_2.scala
new file mode 100644
index 0000000000..4c8c99cbc7
--- /dev/null
+++ b/test/files/neg/t5544/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Api.baz
+}
diff --git a/test/files/neg/t5801.check b/test/files/neg/t5801.check
new file mode 100644
index 0000000000..abf8e6e932
--- /dev/null
+++ b/test/files/neg/t5801.check
@@ -0,0 +1,22 @@
+t5801.scala:1: error: object sth is not a member of package scala
+import scala.sth
+ ^
+t5801.scala:4: error: not found: value sth
+ def foo(a: Int)(implicit b: sth.Sth): Unit = {}
+ ^
+t5801.scala:7: error: not found: value sth
+ def bar(x: Int)(implicit y: Int): sth.Sth = null
+ ^
+t5801.scala:8: error: could not find implicit value for parameter y: Int
+ bar(1)
+ ^
+t5801.scala:10: error: not found: value sth
+ def meh(x: Int)(implicit a: sth.Sth, b: Int): Unit = {}
+ ^
+t5801.scala:13: error: not found: value sth
+ def meh2(x: Int)(implicit b: Int, a: sth.Sth): Unit = {}
+ ^
+t5801.scala:14: error: could not find implicit value for parameter b: Int
+ meh2(1)
+ ^
+7 errors found
diff --git a/test/files/neg/t5801.scala b/test/files/neg/t5801.scala
new file mode 100644
index 0000000000..d452222ac8
--- /dev/null
+++ b/test/files/neg/t5801.scala
@@ -0,0 +1,16 @@
+import scala.sth
+
+object Test extends App {
+ def foo(a: Int)(implicit b: sth.Sth): Unit = {}
+ foo(1)
+
+ def bar(x: Int)(implicit y: Int): sth.Sth = null
+ bar(1)
+
+ def meh(x: Int)(implicit a: sth.Sth, b: Int): Unit = {}
+ meh(1)
+
+ def meh2(x: Int)(implicit b: Int, a: sth.Sth): Unit = {}
+ meh2(1)
+}
+
diff --git a/test/files/run/t3488.check b/test/files/run/t3488.check
new file mode 100644
index 0000000000..0d66ea1aee
--- /dev/null
+++ b/test/files/run/t3488.check
@@ -0,0 +1,2 @@
+0
+1
diff --git a/test/files/run/t3488.scala b/test/files/run/t3488.scala
new file mode 100644
index 0000000000..20a1400dce
--- /dev/null
+++ b/test/files/run/t3488.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ def foo(p: => Unit)(x:Int = 0) = x
+
+ println(foo { val List(_*)=List(0); 1 } ())
+ println(foo { val List(_*)=List(0); 1 } (1))
+}
diff --git a/test/files/run/t4138.check b/test/files/run/t4138.check
new file mode 100644
index 0000000000..f561b5e6b0
--- /dev/null
+++ b/test/files/run/t4138.check
@@ -0,0 +1,2 @@
+[1.45] parsed: "lir 'de\' ' \\ \n / upa \"new\" \t parsing"
+[1.5] parsed: "s "
diff --git a/test/files/run/t4138.scala b/test/files/run/t4138.scala
new file mode 100644
index 0000000000..131489e581
--- /dev/null
+++ b/test/files/run/t4138.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ object p extends scala.util.parsing.combinator.JavaTokenParsers
+
+ println(p.parse(p.stringLiteral, """"lir 'de\' ' \\ \n / upa \"new\" \t parsing""""))
+ println(p.parse(p.stringLiteral, """"s " lkjse""""))
+}
diff --git a/test/files/run/t4461.check b/test/files/run/t4461.check
index b05c7b5589..e9c01e769d 100644
--- a/test/files/run/t4461.check
+++ b/test/files/run/t4461.check
@@ -4,4 +4,8 @@ Include(End,3)
Include(End,4)
Include(End,5)
Include(End,6)
-Include(End,7) \ No newline at end of file
+Include(End,7)
+Script([1] Include(Index(7),8), [2] Include(Index(8),9), [3] Include(Index(9),10))
+Include(Start,0)
+Script([1] Include(Index(0),-2), [2] Include(Index(1),-1))
+Remove(Index(0),-2) \ No newline at end of file
diff --git a/test/files/run/t4461.scala b/test/files/run/t4461.scala
index 99da122f6b..adc9201313 100644
--- a/test/files/run/t4461.scala
+++ b/test/files/run/t4461.scala
@@ -15,5 +15,9 @@ object Test {
buf ++= ArrayBuffer(3, 4) // works
buf ++= List(5) // works
buf ++= collection.immutable.Vector(6, 7) // works
+ buf.insertAll(7, List(8, 9, 10))
+ 0 +=: buf
+ List(-2, -1) ++=: buf
+ buf remove 0
}
}
diff --git a/test/files/run/t5544.check b/test/files/run/t5544.check
new file mode 100644
index 0000000000..257cc5642c
--- /dev/null
+++ b/test/files/run/t5544.check
@@ -0,0 +1 @@
+foo
diff --git a/test/files/run/t5544/Api_1.scala b/test/files/run/t5544/Api_1.scala
new file mode 100644
index 0000000000..b4c92864de
--- /dev/null
+++ b/test/files/run/t5544/Api_1.scala
@@ -0,0 +1,8 @@
+import scala.annotation.StaticAnnotation
+
+class ann(val bar: Any) extends StaticAnnotation
+
+object Api {
+ @ann({def foo = "foo!!"})
+ def foo = println("foo")
+}
diff --git a/test/files/run/t5544/Test_2.scala b/test/files/run/t5544/Test_2.scala
new file mode 100644
index 0000000000..285f8959e0
--- /dev/null
+++ b/test/files/run/t5544/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Api.foo
+}