summaryrefslogtreecommitdiff
path: root/test/files/jvm
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-09-18 00:09:46 -0700
committerPaul Phillips <paulp@improving.org>2013-09-18 07:13:38 -0700
commitf4267ccd96a9143c910c66a5b0436aaa64b7c9dc (patch)
tree174861715807c23ba332f78769a9f7e1377b7f02 /test/files/jvm
parentd45a3c8cc8e9f1d95d797d548a85abd8597f5bc7 (diff)
downloadscala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.tar.gz
scala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.tar.bz2
scala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.zip
Cull extraneous whitespace.
One last flurry with the broom before I leave you slobs to code in your own filth. Eliminated all the trailing whitespace I could manage, with special prejudice reserved for the test cases which depended on the preservation of trailing whitespace. Was reminded I cannot figure out how to eliminate the trailing space on the "scala> " prompt in repl transcripts. At least reduced the number of such empty prompts by trimming transcript code on the way in. Routed ConsoleReporter's "printMessage" through a trailing whitespace stripping method which might help futureproof against the future of whitespace diseases. Deleted the up-to-40 lines of trailing whitespace found in various library files. It seems like only yesterday we performed whitespace surgery on the whole repo. Clearly it doesn't stick very well. I suggest it would work better to enforce a few requirements on the way in.
Diffstat (limited to 'test/files/jvm')
-rw-r--r--test/files/jvm/actor-sync-send-timeout.scala2
-rw-r--r--test/files/jvm/actor-uncaught-exception.scala52
-rw-r--r--test/files/jvm/actor-uncaught-exception2.scala52
-rw-r--r--test/files/jvm/console.scala2
-rw-r--r--test/files/jvm/constant-optimization/Test.scala2
-rw-r--r--test/files/jvm/deprecation/Test_1.scala2
-rw-r--r--test/files/jvm/future-spec/FutureTests.scala178
-rw-r--r--test/files/jvm/future-spec/PromiseTests.scala78
-rw-r--r--test/files/jvm/future-spec/main.scala36
-rw-r--r--test/files/jvm/future-termination.scala26
-rw-r--r--test/files/jvm/inner.scala2
-rw-r--r--test/files/jvm/interpreter.check8
-rw-r--r--test/files/jvm/methvsfield.java6
-rw-r--r--test/files/jvm/natives.scala6
-rw-r--r--test/files/jvm/non-fatal-tests.scala2
-rw-r--r--test/files/jvm/nooptimise/Foo_1.scala2
-rw-r--r--test/files/jvm/nooptimise/Test.scala2
-rw-r--r--test/files/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala2
-rw-r--r--test/files/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala2
-rw-r--r--test/files/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala2
-rw-r--r--test/files/jvm/protectedacc.scala16
-rw-r--r--test/files/jvm/scala-concurrent-tck.scala62
-rw-r--r--test/files/jvm/serialization.scala34
-rw-r--r--test/files/jvm/si5471.scala4
-rw-r--r--test/files/jvm/t1461.scala2
-rw-r--r--test/files/jvm/t1464/MyTrait.scala2
-rw-r--r--test/files/jvm/t1600.scala24
-rw-r--r--test/files/jvm/t2570/Test.scala2
-rw-r--r--test/files/jvm/t3003/Test_1.scala2
-rw-r--r--test/files/jvm/throws-annot.scala10
-rw-r--r--test/files/jvm/typerep.scala2
-rw-r--r--test/files/jvm/unittest_io_Jvm.check2
-rw-r--r--test/files/jvm/unittest_io_Jvm.scala2
-rw-r--r--test/files/jvm/unreachable/Foo_1.scala4
-rw-r--r--test/files/jvm/varargs/JavaClass.java2
-rw-r--r--test/files/jvm/varargs/VaClass.scala4
-rw-r--r--test/files/jvm/xml05.check4
37 files changed, 317 insertions, 325 deletions
diff --git a/test/files/jvm/actor-sync-send-timeout.scala b/test/files/jvm/actor-sync-send-timeout.scala
index 42e0be4a8c..66a0b0a6ff 100644
--- a/test/files/jvm/actor-sync-send-timeout.scala
+++ b/test/files/jvm/actor-sync-send-timeout.scala
@@ -5,7 +5,7 @@ import scala.actors.Actor
/* This test is a regression test for SI-4759.
*/
val Runs = 5
-
+
def main(args: Array[String]) = {
var i = 0
while (i < Runs) {
diff --git a/test/files/jvm/actor-uncaught-exception.scala b/test/files/jvm/actor-uncaught-exception.scala
index 5285b7519f..c28ad2fa3c 100644
--- a/test/files/jvm/actor-uncaught-exception.scala
+++ b/test/files/jvm/actor-uncaught-exception.scala
@@ -7,58 +7,58 @@ class MyException(msg: String) extends Exception(msg) {
}
- case object StartError extends Actor {
- def act() {
+ case object StartError extends Actor {
+ def act() {
try {
- throw new MyException("I don't want to run!")
+ throw new MyException("I don't want to run!")
} catch {
case e: Throwable if (!e.isInstanceOf[scala.util.control.ControlThrowable] &&
!e.isInstanceOf[MyException]) =>
e.printStackTrace()
}
- }
- }
+ }
+ }
- case object MessageError extends Actor {
- def act() {
+ case object MessageError extends Actor {
+ def act() {
try {
- react {
- case _ => throw new MyException("No message for me!")
- }
+ react {
+ case _ => throw new MyException("No message for me!")
+ }
} catch {
case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] =>
e.printStackTrace()
}
- }
- }
+ }
+ }
- case object Supervisor extends Actor {
- def act() {
+ case object Supervisor extends Actor {
+ def act() {
try {
- trapExit = true
+ trapExit = true
link(StartError)
link(MessageError)
- StartError.start()
+ StartError.start()
MessageError.start()
- Actor.loop {
- react {
+ Actor.loop {
+ react {
case Exit(actor, reason) =>
println("OK")
if (actor == StartError)
MessageError ! 'ping
else
exit()
- }
- }
+ }
+ }
} catch {
case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] =>
e.printStackTrace()
}
- }
- }
+ }
+ }
- def main(args: Array[String]) {
- Supervisor.start()
- }
-}
+ def main(args: Array[String]) {
+ Supervisor.start()
+ }
+}
diff --git a/test/files/jvm/actor-uncaught-exception2.scala b/test/files/jvm/actor-uncaught-exception2.scala
index f56217c187..8327b4e19d 100644
--- a/test/files/jvm/actor-uncaught-exception2.scala
+++ b/test/files/jvm/actor-uncaught-exception2.scala
@@ -6,58 +6,58 @@ class MyException(msg: String) extends Exception(msg) {
override def fillInStackTrace() = this
}
- case object StartError extends Actor {
- def act() {
+ case object StartError extends Actor {
+ def act() {
try {
- throw new MyException("I don't want to run!")
+ throw new MyException("I don't want to run!")
} catch {
case e: Throwable if (!e.isInstanceOf[scala.util.control.ControlThrowable] &&
!e.isInstanceOf[MyException]) =>
e.printStackTrace()
}
- }
- }
+ }
+ }
- case object MessageError extends Actor {
- def act() {
+ case object MessageError extends Actor {
+ def act() {
try {
- react {
- case _ => throw new MyException("No message for me!")
- }
+ react {
+ case _ => throw new MyException("No message for me!")
+ }
} catch {
case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] =>
e.printStackTrace()
}
- }
- }
+ }
+ }
- case object Supervisor extends Actor {
- def act() {
+ case object Supervisor extends Actor {
+ def act() {
try {
- trapExit = true
+ trapExit = true
link(StartError)
link(MessageError)
- StartError.start()
+ StartError.start()
MessageError.start()
- Actor.loop {
- react {
+ Actor.loop {
+ react {
case Exit(actor, reason) =>
println(reason)
if (actor == StartError)
MessageError ! 'ping
else
exit()
- }
- }
+ }
+ }
} catch {
case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] =>
e.printStackTrace()
}
- }
- }
+ }
+ }
- def main(args: Array[String]) {
- Supervisor.start()
- }
-}
+ def main(args: Array[String]) {
+ Supervisor.start()
+ }
+}
diff --git a/test/files/jvm/console.scala b/test/files/jvm/console.scala
index 75449416aa..0ac43f2d26 100644
--- a/test/files/jvm/console.scala
+++ b/test/files/jvm/console.scala
@@ -9,6 +9,6 @@ object Test extends App {
flush
println("..")
println(1)
- printf("Argument nr. %d has value %1.2f\n",
+ printf("Argument nr. %d has value %1.2f\n",
1, 10.0/3)
}
diff --git a/test/files/jvm/constant-optimization/Test.scala b/test/files/jvm/constant-optimization/Test.scala
index 283aa6f47a..dc0f8f6103 100644
--- a/test/files/jvm/constant-optimization/Test.scala
+++ b/test/files/jvm/constant-optimization/Test.scala
@@ -6,7 +6,7 @@ import scala.collection.JavaConverters._
object Test extends BytecodeTest {
val comparisons = Set(asm.Opcodes.IF_ACMPEQ, asm.Opcodes.IF_ACMPNE, asm.Opcodes.IF_ICMPEQ, asm.Opcodes.IF_ICMPGE, asm.Opcodes.IF_ICMPGT, asm.Opcodes.IF_ICMPLE,
- asm.Opcodes.IF_ICMPLT, asm.Opcodes.IF_ICMPNE, asm.Opcodes.IFEQ, asm.Opcodes.IFGE, asm.Opcodes.IFGT, asm.Opcodes.IFLE, asm.Opcodes.IFLT,
+ asm.Opcodes.IF_ICMPLT, asm.Opcodes.IF_ICMPNE, asm.Opcodes.IFEQ, asm.Opcodes.IFGE, asm.Opcodes.IFGT, asm.Opcodes.IFLE, asm.Opcodes.IFLT,
asm.Opcodes.IFNE, asm.Opcodes.IFNONNULL, asm.Opcodes.IFNULL)
def show: Unit = {
diff --git a/test/files/jvm/deprecation/Test_1.scala b/test/files/jvm/deprecation/Test_1.scala
index b68a40c94b..0a5b607037 100644
--- a/test/files/jvm/deprecation/Test_1.scala
+++ b/test/files/jvm/deprecation/Test_1.scala
@@ -7,7 +7,7 @@ class Test {
val i = new d.Inner
val w = i.buz()
}
-
+
@deprecated("no longer!", "") class Inner {
@deprecated("uncool", "") def f: Int = 1
@deprecated("this one as well!", "") var g = -1
diff --git a/test/files/jvm/future-spec/FutureTests.scala b/test/files/jvm/future-spec/FutureTests.scala
index 7deb4929d4..5d213691df 100644
--- a/test/files/jvm/future-spec/FutureTests.scala
+++ b/test/files/jvm/future-spec/FutureTests.scala
@@ -13,15 +13,15 @@ import scala.util.{Try,Success,Failure}
object FutureTests extends MinimalScalaTest {
/* some utils */
-
+
def testAsync(s: String)(implicit ec: ExecutionContext): Future[String] = s match {
case "Hello" => future { "World" }
case "Failure" => Future.failed(new RuntimeException("Expected exception; to test fault-tolerance"))
case "NoReply" => Promise[String]().future
}
-
+
val defaultTimeout = 5 seconds
-
+
/* future specification */
"A future with custom ExecutionContext" should {
@@ -31,41 +31,41 @@ object FutureTests extends MinimalScalaTest {
t =>
ms += t
})
-
+
class ThrowableTest(m: String) extends Throwable(m)
-
+
val f1 = future[Any] {
throw new ThrowableTest("test")
}
-
+
intercept[ThrowableTest] {
Await.result(f1, defaultTimeout)
}
-
+
val latch = new TestLatch
val f2 = future {
Await.ready(latch, 5 seconds)
"success"
}
val f3 = f2 map { s => s.toUpperCase }
-
+
f2 foreach { _ => throw new ThrowableTest("dispatcher foreach") }
f2 onSuccess { case _ => throw new ThrowableTest("dispatcher receive") }
-
+
latch.open()
-
+
Await.result(f2, defaultTimeout) mustBe ("success")
-
+
f2 foreach { _ => throw new ThrowableTest("current thread foreach") }
f2 onSuccess { case _ => throw new ThrowableTest("current thread receive") }
-
+
Await.result(f3, defaultTimeout) mustBe ("SUCCESS")
-
+
val waiting = future {
Thread.sleep(1000)
}
Await.ready(waiting, 2000 millis)
-
+
ms.size mustBe (4)
//FIXME should check
}
@@ -110,24 +110,24 @@ object FutureTests extends MinimalScalaTest {
val future0 = future[Any] {
"five!".length
}
-
+
val future1 = for {
a <- future0.mapTo[Int] // returns 5
b <- async(a) // returns "10"
c <- async(7) // returns "14"
} yield b + "-" + c
-
+
val future2 = for {
a <- future0.mapTo[Int]
b <- (future { (a * 2).toString }).mapTo[Int]
- c <- future { (7 * 2).toString }
+ c <- future { (7 * 2).toString }
} yield b + "-" + c
-
+
Await.result(future1, defaultTimeout) mustBe ("10-14")
assert(checkType(future1, manifest[String]))
intercept[ClassCastException] { Await.result(future2, defaultTimeout) }
}
-
+
"support pattern matching within a for-comprehension" in {
case class Req[T](req: T)
case class Res[T](res: T)
@@ -135,44 +135,44 @@ object FutureTests extends MinimalScalaTest {
case Req(s: String) => future { Res(s.length) }
case Req(i: Int) => future { Res((i * 2).toString) }
}
-
+
val future1 = for {
Res(a: Int) <- async(Req("Hello"))
Res(b: String) <- async(Req(a))
Res(c: String) <- async(Req(7))
} yield b + "-" + c
-
+
val future2 = for {
Res(a: Int) <- async(Req("Hello"))
Res(b: Int) <- async(Req(a))
Res(c: Int) <- async(Req(7))
} yield b + "-" + c
-
+
Await.result(future1, defaultTimeout) mustBe ("10-14")
intercept[NoSuchElementException] { Await.result(future2, defaultTimeout) }
}
-
+
"recover from exceptions" in {
val future1 = Future(5)
val future2 = future1 map (_ / 0)
val future3 = future2 map (_.toString)
-
+
val future4 = future1 recover {
case e: ArithmeticException => 0
} map (_.toString)
-
+
val future5 = future2 recover {
case e: ArithmeticException => 0
} map (_.toString)
-
+
val future6 = future2 recover {
case e: MatchError => 0
} map (_.toString)
-
+
val future7 = future3 recover {
case e: ArithmeticException => "You got ERROR"
}
-
+
val future8 = testAsync("Failure")
val future9 = testAsync("Failure") recover {
case e: RuntimeException => "FAIL!"
@@ -183,7 +183,7 @@ object FutureTests extends MinimalScalaTest {
val future11 = testAsync("Failure") recover {
case _ => "Oops!"
}
-
+
Await.result(future1, defaultTimeout) mustBe (5)
intercept[ArithmeticException] { Await.result(future2, defaultTimeout) }
intercept[ArithmeticException] { Await.result(future3, defaultTimeout) }
@@ -196,23 +196,23 @@ object FutureTests extends MinimalScalaTest {
Await.result(future10, defaultTimeout) mustBe ("World")
Await.result(future11, defaultTimeout) mustBe ("Oops!")
}
-
+
"recoverWith from exceptions" in {
val o = new IllegalStateException("original")
val r = new IllegalStateException("recovered")
-
+
intercept[IllegalStateException] {
val failed = Future.failed[String](o) recoverWith {
case _ if false == true => Future.successful("yay!")
}
Await.result(failed, defaultTimeout)
} mustBe (o)
-
+
val recovered = Future.failed[String](o) recoverWith {
case _ => Future.successful("yay!")
}
Await.result(recovered, defaultTimeout) mustBe ("yay!")
-
+
intercept[IllegalStateException] {
val refailed = Future.failed[String](o) recoverWith {
case _ => Future.failed[String](r)
@@ -220,7 +220,7 @@ object FutureTests extends MinimalScalaTest {
Await.result(refailed, defaultTimeout)
} mustBe (r)
}
-
+
"andThen like a boss" in {
val q = new java.util.concurrent.LinkedBlockingQueue[Int]
for (i <- 1 to 1000) {
@@ -240,28 +240,28 @@ object FutureTests extends MinimalScalaTest {
q.clear()
}
}
-
+
"firstCompletedOf" in {
def futures = Vector.fill[Future[Int]](10) {
Promise[Int]().future
} :+ Future.successful[Int](5)
-
+
Await.result(Future.firstCompletedOf(futures), defaultTimeout) mustBe (5)
Await.result(Future.firstCompletedOf(futures.iterator), defaultTimeout) mustBe (5)
}
-
+
"find" in {
val futures = for (i <- 1 to 10) yield future {
i
}
-
+
val result = Future.find[Int](futures)(_ == 3)
Await.result(result, defaultTimeout) mustBe (Some(3))
val notFound = Future.find[Int](futures.iterator)(_ == 11)
Await.result(notFound, defaultTimeout) mustBe (None)
}
-
+
"zip" in {
val timeout = 10000 millis
val f = new IllegalStateException("test")
@@ -269,48 +269,48 @@ object FutureTests extends MinimalScalaTest {
val failed = Future.failed[String](f) zip Future.successful("foo")
Await.result(failed, timeout)
} mustBe (f)
-
+
intercept[IllegalStateException] {
val failed = Future.successful("foo") zip Future.failed[String](f)
Await.result(failed, timeout)
} mustBe (f)
-
+
intercept[IllegalStateException] {
val failed = Future.failed[String](f) zip Future.failed[String](f)
Await.result(failed, timeout)
} mustBe (f)
-
+
val successful = Future.successful("foo") zip Future.successful("foo")
Await.result(successful, timeout) mustBe (("foo", "foo"))
}
-
+
"fold" in {
val timeout = 10000 millis
def async(add: Int, wait: Int) = future {
Thread.sleep(wait)
add
}
-
+
val futures = (0 to 9) map {
idx => async(idx, idx * 20)
}
val folded = Future.fold(futures)(0)(_ + _)
Await.result(folded, timeout) mustBe (45)
-
+
val futuresit = (0 to 9) map {
idx => async(idx, idx * 20)
}
val foldedit = Future.fold(futures)(0)(_ + _)
Await.result(foldedit, timeout) mustBe (45)
}
-
+
"fold by composing" in {
val timeout = 10000 millis
def async(add: Int, wait: Int) = future {
Thread.sleep(wait)
add
}
- def futures = (0 to 9) map {
+ def futures = (0 to 9) map {
idx => async(idx, idx * 20)
}
val folded = futures.foldLeft(Future(0)) {
@@ -318,7 +318,7 @@ object FutureTests extends MinimalScalaTest {
}
Await.result(folded, timeout) mustBe (45)
}
-
+
"fold with an exception" in {
val timeout = 10000 millis
def async(add: Int, wait: Int) = future {
@@ -334,7 +334,7 @@ object FutureTests extends MinimalScalaTest {
Await.result(folded, timeout)
}.getMessage mustBe ("shouldFoldResultsWithException: expected")
}
-
+
"fold mutable zeroes safely" in {
import scala.collection.mutable.ArrayBuffer
def test(testNumber: Int) {
@@ -344,34 +344,34 @@ object FutureTests extends MinimalScalaTest {
case (l, _) => l
}
val result = Await.result(f.mapTo[ArrayBuffer[Int]], 10000 millis).sum
-
+
assert(result == 250500)
}
(1 to 100) foreach test //Make sure it tries to provoke the problem
}
-
+
"return zero value if folding empty list" in {
val zero = Future.fold(List[Future[Int]]())(0)(_ + _)
Await.result(zero, defaultTimeout) mustBe (0)
}
-
+
"shouldReduceResults" in {
def async(idx: Int) = future {
Thread.sleep(idx * 20)
idx
}
val timeout = 10000 millis
-
+
val futures = (0 to 9) map { async }
val reduced = Future.reduce(futures)(_ + _)
Await.result(reduced, timeout) mustBe (45)
-
+
val futuresit = (0 to 9) map { async }
val reducedit = Future.reduce(futuresit)(_ + _)
Await.result(reducedit, timeout) mustBe (45)
}
-
+
"shouldReduceResultsWithException" in {
def async(add: Int, wait: Int) = future {
Thread.sleep(wait)
@@ -387,14 +387,14 @@ object FutureTests extends MinimalScalaTest {
Await.result(failed, timeout)
}.getMessage mustBe ("shouldFoldResultsWithException: expected")
}
-
+
"shouldReduceThrowNSEEOnEmptyInput" in {
intercept[java.util.NoSuchElementException] {
val emptyreduced = Future.reduce(List[Future[Int]]())(_ + _)
Await.result(emptyreduced, defaultTimeout)
}
}
-
+
"shouldTraverseFutures" in {
object counter {
var count = -1
@@ -403,23 +403,23 @@ object FutureTests extends MinimalScalaTest {
count
}
}
-
+
val oddFutures = List.fill(100)(future { counter.incAndGet() }).iterator
val traversed = Future.sequence(oddFutures)
Await.result(traversed, defaultTimeout).sum mustBe (10000)
-
+
val list = (1 to 100).toList
val traversedList = Future.traverse(list)(x => Future(x * 2 - 1))
Await.result(traversedList, defaultTimeout).sum mustBe (10000)
-
+
val iterator = (1 to 100).toList.iterator
val traversedIterator = Future.traverse(iterator)(x => Future(x * 2 - 1))
Await.result(traversedIterator, defaultTimeout).sum mustBe (10000)
}
-
+
"shouldBlockUntilResult" in {
val latch = new TestLatch
-
+
val f = future {
Await.ready(latch, 5 seconds)
5
@@ -428,28 +428,28 @@ object FutureTests extends MinimalScalaTest {
val res = Await.result(f, Inf)
res + 9
}
-
+
intercept[TimeoutException] {
Await.ready(f2, 100 millis)
}
-
+
latch.open()
-
+
Await.result(f2, defaultTimeout) mustBe (14)
-
+
val f3 = future {
Thread.sleep(100)
5
}
-
+
intercept[TimeoutException] {
Await.ready(f3, 0 millis)
}
}
-
+
"run callbacks async" in {
val latch = Vector.fill(10)(new TestLatch)
-
+
val f1 = future {
latch(0).open()
Await.ready(latch(1), TestLatch.DefaultTimeout)
@@ -462,18 +462,18 @@ object FutureTests extends MinimalScalaTest {
s.length
}
for (_ <- f2) latch(4).open()
-
+
Await.ready(latch(0), TestLatch.DefaultTimeout)
-
+
f1.isCompleted mustBe (false)
f2.isCompleted mustBe (false)
-
+
latch(1).open()
Await.ready(latch(2), TestLatch.DefaultTimeout)
-
+
f1.isCompleted mustBe (true)
f2.isCompleted mustBe (false)
-
+
val f3 = f1 map {
s =>
latch(5).open()
@@ -481,17 +481,17 @@ object FutureTests extends MinimalScalaTest {
s.length * 2
}
for (_ <- f3) latch(3).open()
-
+
Await.ready(latch(5), TestLatch.DefaultTimeout)
-
+
f3.isCompleted mustBe (false)
-
+
latch(6).open()
Await.ready(latch(4), TestLatch.DefaultTimeout)
-
+
f2.isCompleted mustBe (true)
f3.isCompleted mustBe (true)
-
+
val p1 = Promise[String]()
val f4 = p1.future map {
s =>
@@ -500,23 +500,23 @@ object FutureTests extends MinimalScalaTest {
s.length
}
for (_ <- f4) latch(9).open()
-
+
p1.future.isCompleted mustBe (false)
f4.isCompleted mustBe (false)
-
+
p1 complete Success("Hello")
-
+
Await.ready(latch(7), TestLatch.DefaultTimeout)
-
+
p1.future.isCompleted mustBe (true)
f4.isCompleted mustBe (false)
-
+
latch(8).open()
Await.ready(latch(9), TestLatch.DefaultTimeout)
-
+
Await.ready(f4, defaultTimeout).isCompleted mustBe (true)
}
-
+
"should not deadlock with nested await (ticket 1313)" in {
val simple = Future() map {
_ =>
@@ -525,7 +525,7 @@ object FutureTests extends MinimalScalaTest {
Await.result(umap, Inf)
}
Await.ready(simple, Inf).isCompleted mustBe (true)
-
+
val l1, l2 = new TestLatch
val complex = Future() map {
_ =>
@@ -545,9 +545,9 @@ object FutureTests extends MinimalScalaTest {
val f = future(5).map(_ / 0)
Await.ready(f, defaultTimeout).value.get.toString mustBe expected.toString
}
-
+
}
-
+
}
diff --git a/test/files/jvm/future-spec/PromiseTests.scala b/test/files/jvm/future-spec/PromiseTests.scala
index 8e07393900..6e613bf3ec 100644
--- a/test/files/jvm/future-spec/PromiseTests.scala
+++ b/test/files/jvm/future-spec/PromiseTests.scala
@@ -13,29 +13,29 @@ object PromiseTests extends MinimalScalaTest {
import ExecutionContext.Implicits._
val defaultTimeout = Inf
-
+
/* promise specification */
-
+
"An empty Promise" should {
-
+
"not be completed" in {
val p = Promise()
p.future.isCompleted mustBe (false)
p.isCompleted mustBe (false)
}
-
+
"have no value" in {
val p = Promise()
p.future.value mustBe (None)
p.isCompleted mustBe (false)
}
-
+
"return supplied value on timeout" in {
val failure = Promise.failed[String](new RuntimeException("br0ken")).future
val otherFailure = Promise.failed[String](new RuntimeException("last")).future
val empty = Promise[String]().future
val timedOut = Promise.successful[String]("Timedout").future
-
+
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")
@@ -43,47 +43,47 @@ object PromiseTests extends MinimalScalaTest {
Await.result(failure fallbackTo otherFailure, defaultTimeout)
}.getMessage mustBe ("last")
}
-
+
}
-
+
"A successful Promise" should {
val result = "test value"
val promise = Promise[String]().complete(Success(result))
promise.isCompleted mustBe (true)
futureWithResult(_(promise.future, result))
}
-
+
"A failed Promise" should {
val message = "Expected Exception"
val promise = Promise[String]().complete(Failure(new RuntimeException(message)))
promise.isCompleted mustBe (true)
futureWithException[RuntimeException](_(promise.future, message))
}
-
+
"An interrupted Promise" should {
val message = "Boxed InterruptedException"
val future = Promise[String]().complete(Failure(new InterruptedException(message))).future
futureWithException[ExecutionException](_(future, message))
}
-
+
"A NonLocalReturnControl failed Promise" should {
val result = "test value"
val future = Promise[String]().complete(Failure(new NonLocalReturnControl[String]("test", result))).future
futureWithResult(_(future, result))
}
-
+
def futureWithResult(f: ((Future[Any], Any) => Unit) => Unit) {
-
+
"be completed" in { f((future, _) => future.isCompleted mustBe (true)) }
-
+
"contain a value" in { f((future, result) => future.value mustBe (Some(Success(result)))) }
-
+
"return when ready with 'Await.ready'" in { f((future, result) => Await.ready(future, defaultTimeout).isCompleted mustBe (true)) }
-
+
"return result with 'Await.result'" in { f((future, result) => Await.result(future, defaultTimeout) mustBe (result)) }
-
+
"not timeout" in { f((future, _) => Await.ready(future, 0 millis)) }
-
+
"filter result" in {
f {
(future, result) =>
@@ -93,16 +93,16 @@ object PromiseTests extends MinimalScalaTest {
}
}
}
-
+
"transform result with map" in { f((future, result) => Await.result((future map (_.toString.length)), defaultTimeout) mustBe (result.toString.length)) }
-
+
"compose result with flatMap" in {
f { (future, result) =>
val r = for (r <- future; p <- Promise.successful("foo").future) yield r.toString + p
Await.result(r, defaultTimeout) mustBe (result.toString + "foo")
}
}
-
+
"perform action with foreach" in {
f {
(future, result) =>
@@ -111,7 +111,7 @@ object PromiseTests extends MinimalScalaTest {
Await.result(p.future, defaultTimeout) mustBe (result)
}
}
-
+
"zip properly" in {
f {
(future, result) =>
@@ -121,9 +121,9 @@ object PromiseTests extends MinimalScalaTest {
}.getMessage mustBe ("ohnoes")
}
}
-
+
"not recover from exception" in { f((future, result) => Await.result(future.recover({ case _ => "pigdog" }), defaultTimeout) mustBe (result)) }
-
+
"perform action on result" in {
f {
(future, result) =>
@@ -132,7 +132,7 @@ object PromiseTests extends MinimalScalaTest {
Await.result(p.future, defaultTimeout) mustBe (result)
}
}
-
+
"not project a failure" in {
f {
(future, result) =>
@@ -141,34 +141,34 @@ object PromiseTests extends MinimalScalaTest {
}.getMessage mustBe ("Future.failed not completed with a throwable.")
}
}
-
+
"cast using mapTo" in {
f {
(future, result) =>
Await.result(future.mapTo[Boolean].recover({ case _: ClassCastException ⇒ false }), defaultTimeout) mustBe (false)
}
}
-
+
}
def futureWithException[E <: Throwable: Manifest](f: ((Future[Any], String) => Unit) => Unit) {
-
+
"be completed" in {
f((future, _) => future.isCompleted mustBe (true))
}
-
+
"contain a value" in {
f((future, message) => {
future.value.get.failed.get.getMessage mustBe (message)
})
}
-
+
"throw not throw exception with 'Await.ready'" in {
f {
(future, message) => Await.ready(future, defaultTimeout).isCompleted mustBe (true)
}
}
-
+
"throw exception with 'Await.result'" in {
f {
(future, message) =>
@@ -177,7 +177,7 @@ object PromiseTests extends MinimalScalaTest {
}.getMessage mustBe (message)
}
}
-
+
"retain exception with filter" in {
f {
(future, message) =>
@@ -185,21 +185,21 @@ object PromiseTests extends MinimalScalaTest {
intercept[E] { Await.result(future filter (_ => false), defaultTimeout) }.getMessage mustBe (message)
}
}
-
+
"retain exception with map" in {
f {
(future, message) =>
intercept[E] { Await.result(future map (_.toString.length), defaultTimeout) }.getMessage mustBe (message)
}
}
-
+
"retain exception with flatMap" in {
f {
(future, message) =>
intercept[E] { Await.result(future flatMap (_ => Promise.successful("foo").future), defaultTimeout) }.getMessage mustBe (message)
}
}
-
+
"zip properly" in {
f {
(future, message) =>
@@ -208,18 +208,18 @@ object PromiseTests extends MinimalScalaTest {
}.getMessage mustBe (message)
}
}
-
+
"recover from exception" in {
f {
(future, message) =>
Await.result(future.recover({ case e if e.getMessage == message ⇒ "pigdog" }), defaultTimeout) mustBe ("pigdog")
}
}
-
+
"project a failure" in {
f((future, message) => Await.result(future.failed, defaultTimeout).getMessage mustBe (message))
}
-
+
"perform action on exception" in {
f {
(future, message) =>
@@ -228,7 +228,7 @@ object PromiseTests extends MinimalScalaTest {
Await.result(p.future, defaultTimeout) mustBe (message)
}
}
-
+
"always cast successfully using mapTo" in {
f {
(future, message) =>
diff --git a/test/files/jvm/future-spec/main.scala b/test/files/jvm/future-spec/main.scala
index e000431dda..132263e2e8 100644
--- a/test/files/jvm/future-spec/main.scala
+++ b/test/files/jvm/future-spec/main.scala
@@ -8,13 +8,13 @@ import java.util.concurrent.{ TimeoutException, CountDownLatch, TimeUnit }
object Test {
-
+
def main(args: Array[String]) {
FutureTests.check()
PromiseTests.check()
TryTests.check()
}
-
+
}
trait Features {
@@ -26,7 +26,7 @@ trait Features {
trait Output {
val buffer = new StringBuilder
-
+
def bufferPrintln(a: Any) = buffer.synchronized {
buffer.append(a.toString + "\n")
}
@@ -34,20 +34,20 @@ trait Output {
trait MinimalScalaTest extends Output with Features {
-
+
val throwables = mutable.ArrayBuffer[Throwable]()
-
+
def check() {
if (throwables.nonEmpty) println(buffer.toString)
}
-
+
implicit def stringops(s: String) = new {
-
+
def should[U](snippets: =>U) = {
bufferPrintln(s + " should:")
snippets
}
-
+
def in[U](snippet: =>U) = {
try {
bufferPrintln("- " + s)
@@ -60,16 +60,16 @@ trait MinimalScalaTest extends Output with Features {
throwables += e
}
}
-
+
}
-
+
implicit def objectops(obj: Any) = new {
-
+
def mustBe(other: Any) = assert(obj == other, obj + " is not " + other)
def mustEqual(other: Any) = mustBe(other)
-
+
}
-
+
def intercept[T <: Throwable: Manifest](body: =>Any): T = {
try {
body
@@ -80,7 +80,7 @@ trait MinimalScalaTest extends Output with Features {
else t.asInstanceOf[T]
}
}
-
+
def checkType[T: Manifest, S](in: Future[T], refmanifest: Manifest[S]): Boolean = manifest[T] == refmanifest
}
@@ -94,23 +94,23 @@ object TestLatch {
class TestLatch(count: Int = 1) extends Awaitable[Unit] {
private var latch = new CountDownLatch(count)
-
+
def countDown() = latch.countDown()
def isOpen: Boolean = latch.getCount == 0
def open() = while (!isOpen) countDown()
def reset() = latch = new CountDownLatch(count)
-
+
@throws(classOf[TimeoutException])
def ready(atMost: Duration)(implicit permit: CanAwait) = {
val opened = latch.await(atMost.toNanos, TimeUnit.NANOSECONDS)
if (!opened) throw new TimeoutException("Timeout of %s." format (atMost.toString))
this
}
-
+
@throws(classOf[Exception])
def result(atMost: Duration)(implicit permit: CanAwait): Unit = {
ready(atMost)
}
-
+
}
diff --git a/test/files/jvm/future-termination.scala b/test/files/jvm/future-termination.scala
index 668b3f74ba..90ea336ce8 100644
--- a/test/files/jvm/future-termination.scala
+++ b/test/files/jvm/future-termination.scala
@@ -1,21 +1,21 @@
-
-/* Test that unevaluated futures do not prevent program termination */
-
+
+/* Test that unevaluated futures do not prevent program termination */
+
@deprecated("Suppress warnings", since="2.11")
-object Test {
- import scala.actors.Futures
- def main(args: Array[String]) {
+object Test {
+ import scala.actors.Futures
+ def main(args: Array[String]) {
try {
- val meaningOfLife = Futures.future {
- Thread.sleep(5000) // pretend this is a harder problem than it is
- println("I have the answer!")
- 42
- }
- println("I can't wait that long, bye.")
+ val meaningOfLife = Futures.future {
+ Thread.sleep(5000) // pretend this is a harder problem than it is
+ println("I have the answer!")
+ 42
+ }
+ println("I can't wait that long, bye.")
} catch {
case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] =>
e.printStackTrace()
}
- }
+ }
}
diff --git a/test/files/jvm/inner.scala b/test/files/jvm/inner.scala
index 009d52e5bc..c05e803449 100644
--- a/test/files/jvm/inner.scala
+++ b/test/files/jvm/inner.scala
@@ -14,7 +14,7 @@ class A {
trait Itf {
def method1(x: Int): Int
-
+
trait Itf2 extends Itf {
def method2: Unit
}
diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check
index 44930c2932..6e5fada381 100644
--- a/test/files/jvm/interpreter.check
+++ b/test/files/jvm/interpreter.check
@@ -1,8 +1,6 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> // basics
scala> 3+4
@@ -301,7 +299,7 @@ scala> <a>
c="c"
d="dd"
/></a>
-res8: scala.xml.Elem =
+res8: scala.xml.Elem =
<a>
<b c="c" d="dd"/></a>
@@ -324,7 +322,7 @@ scala> """
hello
there
"""
-res12: String =
+res12: String =
"
hello
there
@@ -364,8 +362,6 @@ It would fail on the following inputs: Exp(), Term()
f: (e: Exp)Int
scala>
-
-scala>
plusOne: (x: Int)Int
res0: Int = 6
res0: String = after reset
diff --git a/test/files/jvm/methvsfield.java b/test/files/jvm/methvsfield.java
index c1b2b87b48..dadc98669a 100644
--- a/test/files/jvm/methvsfield.java
+++ b/test/files/jvm/methvsfield.java
@@ -1,11 +1,11 @@
// This should be compiled with javac and saved
// in ../lib/methvsfield.jar .
-class MethVsField
+class MethVsField
{
int three = 3;
- int three()
- {
+ int three()
+ {
return 3;
}
}
diff --git a/test/files/jvm/natives.scala b/test/files/jvm/natives.scala
index ba868dc85e..14ee4e1c1b 100644
--- a/test/files/jvm/natives.scala
+++ b/test/files/jvm/natives.scala
@@ -1,16 +1,16 @@
object Test {
//println("java.library.path=" + System.getProperty("java.library.path"))
-
+
val sysWordSize = System.getProperty("sun.arch.data.model", "32")
val sysType = System.getProperty("os.name")
-
+
val libName =
if (sysType == "Mac OS X")
"natives"
else
"natives-" + sysWordSize
-
+
System.loadLibrary(libName)
@native
diff --git a/test/files/jvm/non-fatal-tests.scala b/test/files/jvm/non-fatal-tests.scala
index 22c7cba51f..791b1d3100 100644
--- a/test/files/jvm/non-fatal-tests.scala
+++ b/test/files/jvm/non-fatal-tests.scala
@@ -9,7 +9,7 @@ trait NonFatalTests {
new Exception,
new Throwable,
new NotImplementedError)
-
+
//Fatals
val fatals: Seq[Throwable] =
Seq(new InterruptedException,
diff --git a/test/files/jvm/nooptimise/Foo_1.scala b/test/files/jvm/nooptimise/Foo_1.scala
index c6f1b06c8e..896d5695de 100644
--- a/test/files/jvm/nooptimise/Foo_1.scala
+++ b/test/files/jvm/nooptimise/Foo_1.scala
@@ -3,6 +3,6 @@ class Foo_1 {
// optimization will remove this magic 3 from appearing in the source
// so -Ynooptimize should prevent that
val x = 3
-
+
}
}
diff --git a/test/files/jvm/nooptimise/Test.scala b/test/files/jvm/nooptimise/Test.scala
index ec8daa6e16..7b7ecd6dbd 100644
--- a/test/files/jvm/nooptimise/Test.scala
+++ b/test/files/jvm/nooptimise/Test.scala
@@ -8,7 +8,7 @@ object Test extends BytecodeTest {
val classNode = loadClassNode("Foo_1")
val methodNode = getMethod(classNode, "foo")
// if optimization didn't run then
- // there should be some useless instructions
+ // there should be some useless instructions
// with the magic constant 3
val expected = 1
val got = countMagicThrees(methodNode.instructions)
diff --git a/test/files/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala b/test/files/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala
index fa3639380d..b0506018f6 100644
--- a/test/files/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala
+++ b/test/files/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala
@@ -6,7 +6,7 @@
class SameBytecode {
case class Foo(x: Any, y: String)
- def a =
+ def a =
Foo(1, "a") match {
case Foo(_: String, y) => y
}
diff --git a/test/files/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala b/test/files/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala
index 3a594c401e..1e4d564cdf 100644
--- a/test/files/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala
+++ b/test/files/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala
@@ -3,7 +3,7 @@
case class Foo(x: Any)
class SameBytecode {
- def a =
+ def a =
(Foo(1): Any) match {
case Foo(_: String) =>
}
diff --git a/test/files/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala b/test/files/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala
index e5db6c4dd0..c961082fa7 100644
--- a/test/files/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala
+++ b/test/files/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala
@@ -3,7 +3,7 @@
class SameBytecode {
case class Foo(x: Int, y: String)
- def a =
+ def a =
Foo(1, "a") match {
case Foo(_: Int, y) => y
}
diff --git a/test/files/jvm/protectedacc.scala b/test/files/jvm/protectedacc.scala
index f213e0da19..89e70b90d8 100644
--- a/test/files/jvm/protectedacc.scala
+++ b/test/files/jvm/protectedacc.scala
@@ -16,7 +16,7 @@ object Test {
val ji = new p.b.JavaInteraction(Array('a', 'b', 'c'));
(new ji.Inner).m;
-
+
(new p.b.OuterObj.Inner).m
}
}
@@ -36,13 +36,13 @@ package p {
def getA: this.type = this;
}
-
+
/** Test type members */
trait HighlighterXXX {
type Node;
protected def highlight(node : Node) : Unit;
}
-
+
/** Test type parameters */
abstract class PolyA[a] {
protected def m(x: a): Unit;
@@ -119,22 +119,22 @@ package p {
val inc = meth2(1)_;
Console.println("100 = " + inc("10"));
-
+
getA.x;
}
}
}
-
+
trait ScalaAutoEditXXX extends HighlighterXXX {
- trait NodeImpl {
+ trait NodeImpl {
def self : Node;
highlight(self);
}
}
-
+
abstract class X[T] extends PolyA[T] {
- trait Inner extends B {
+ trait Inner extends B {
def self: T;
def self2: Node;
def getB: Inner;
diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala
index 6e2b8ca033..5006793084 100644
--- a/test/files/jvm/scala-concurrent-tck.scala
+++ b/test/files/jvm/scala-concurrent-tck.scala
@@ -38,12 +38,12 @@ trait FutureCallbacks extends TestBase {
val f = future { x = 1 }
f onSuccess { case _ => done(x == 1) }
}
-
+
def testOnSuccessWhenCompleted(): Unit = once {
done =>
var x = 0
val f = future { x = 1 }
- f onSuccess {
+ f onSuccess {
case _ if x == 1 =>
x = 2
f onSuccess { case _ => done(x == 2) }
@@ -56,7 +56,7 @@ trait FutureCallbacks extends TestBase {
f onSuccess { case _ => done(false) }
f onFailure { case _ => done(true) }
}
-
+
def testOnFailure(): Unit = once {
done =>
val f = future[Unit] { throw new Exception }
@@ -73,7 +73,7 @@ trait FutureCallbacks extends TestBase {
case _ => done(false)
}
}
-
+
def testOnFailureWhenTimeoutException(): Unit = once {
done =>
val f = future[Unit] { throw new TimeoutException() }
@@ -89,7 +89,7 @@ trait FutureCallbacks extends TestBase {
(0 to 10000).map(Future(_)).foldLeft(promise.future)((f1, f2) => f2.flatMap(i => f1))
promise.success(-1)
}
-
+
testOnSuccess()
testOnSuccessWhenCompleted()
testOnSuccessWhenFailed()
@@ -236,7 +236,7 @@ def testTransformFailure(): Unit = once {
val f = future[Int] { 5 }
f foreach { x => p.success(x * 2) }
val g = p.future
-
+
g.onSuccess { case res: Int => done(res == 10) }
g.onFailure { case _ => done(false) }
}
@@ -248,7 +248,7 @@ def testTransformFailure(): Unit = once {
f foreach { x => p.success(x * 2) }
f onFailure { case _ => p.failure(new Exception) }
val g = p.future
-
+
g.onSuccess { case _ => done(false) }
g.onFailure { case _ => done(true) }
}
@@ -276,7 +276,7 @@ def testTransformFailure(): Unit = once {
f onSuccess { case _ => done(false) }
f onFailure { case any => done(any == cause) }
}
-
+
def testRecoverWithSuccess(): Unit = once {
done =>
val cause = new RuntimeException
@@ -302,7 +302,7 @@ def testTransformFailure(): Unit = once {
f onSuccess { case x => done(false) }
f onFailure { case any => done(any == cause) }
}
-
+
def testZipSuccess(): Unit = once {
done =>
val f = future { 5 }
@@ -388,14 +388,14 @@ trait FutureProjections extends TestBase {
case Failure(t) => done(false)
}
}
-
+
def testFailedFailureOnSuccess(): Unit = once {
done =>
val cause = new RuntimeException
val f = future { throw cause }
f.failed onSuccess { case t => done(t == cause) }
}
-
+
def testFailedSuccessOnComplete(): Unit = once {
done =>
val f = future { 0 }
@@ -404,7 +404,7 @@ trait FutureProjections extends TestBase {
case _ => done(false)
}
}
-
+
def testFailedSuccessOnFailure(): Unit = once {
done =>
val f = future { 0 }
@@ -414,14 +414,14 @@ trait FutureProjections extends TestBase {
}
f.failed onSuccess { case _ => done(false) }
}
-
+
def testFailedFailureAwait(): Unit = once {
done =>
val cause = new RuntimeException
val f = future { throw cause }
done(Await.result(f.failed, Duration(500, "ms")) == cause)
}
-
+
def testFailedSuccessAwait(): Unit = once {
done =>
val f = future { 0 }
@@ -456,7 +456,7 @@ trait FutureProjections extends TestBase {
done(true)
} onFailure { case x => done(throw x) }
}
-
+
testFailedFailureOnComplete()
testFailedFailureOnSuccess()
testFailedSuccessOnComplete()
@@ -476,7 +476,7 @@ trait Blocking extends TestBase {
val f = future { 0 }
done(Await.result(f, Duration(500, "ms")) == 0)
}
-
+
def testAwaitFailure(): Unit = once {
done =>
val cause = new RuntimeException
@@ -488,13 +488,13 @@ trait Blocking extends TestBase {
case t: Throwable => done(t == cause)
}
}
-
+
def testFQCNForAwaitAPI(): Unit = once {
done =>
- done(classOf[CanAwait].getName == "scala.concurrent.CanAwait" &&
+ done(classOf[CanAwait].getName == "scala.concurrent.CanAwait" &&
Await.getClass.getName == "scala.concurrent.Await")
}
-
+
testAwaitSuccess()
testAwaitFailure()
testFQCNForAwaitAPI()
@@ -564,10 +564,10 @@ trait Promises extends TestBase {
done =>
val p = promise[Int]()
val f = p.future
-
+
f onSuccess { case x => done(x == 5) }
f onFailure { case any => done(false) }
-
+
p.success(5)
}
@@ -576,10 +576,10 @@ trait Promises extends TestBase {
val e = new Exception("expected")
val p = promise[Int]()
val f = p.future
-
+
f onSuccess { case x => done(false) }
f onFailure { case any => done(any eq e) }
-
+
p.failure(e)
}
@@ -715,13 +715,13 @@ trait ExecutionContextPrepare extends TestBase {
val theLocal = new ThreadLocal[String] {
override protected def initialValue(): String = ""
}
-
+
class PreparingExecutionContext extends ExecutionContext {
def delegate = ExecutionContext.global
-
+
override def execute(runnable: Runnable): Unit =
delegate.execute(runnable)
-
+
override def prepare(): ExecutionContext = {
// save object stored in ThreadLocal storage
val localData = theLocal.get
@@ -739,27 +739,27 @@ trait ExecutionContextPrepare extends TestBase {
}
}
}
-
+
override def reportFailure(t: Throwable): Unit =
delegate.reportFailure(t)
}
-
+
implicit val ec = new PreparingExecutionContext
-
+
def testOnComplete(): Unit = once {
done =>
theLocal.set("secret")
val fut = future { 42 }
fut onComplete { case _ => done(theLocal.get == "secret") }
}
-
+
def testMap(): Unit = once {
done =>
theLocal.set("secret2")
val fut = future { 42 }
fut map { x => done(theLocal.get == "secret2") }
}
-
+
testOnComplete()
testMap()
}
diff --git a/test/files/jvm/serialization.scala b/test/files/jvm/serialization.scala
index 2bb9db3f72..bc61235267 100644
--- a/test/files/jvm/serialization.scala
+++ b/test/files/jvm/serialization.scala
@@ -297,7 +297,7 @@ object Test3_mutable {
ab1 ++= List("one", "two")
val _ab1: ArrayBuffer[String] = read(write(ab1))
check(ab1, _ab1)
-
+
// ArrayBuilder
val abu1 = ArrayBuilder.make[Long]
val _abu1: ArrayBuilder[ClassManifest[Long]] = read(write(abu1))
@@ -306,12 +306,12 @@ object Test3_mutable {
val abu2 = ArrayBuilder.make[Float]
val _abu2: ArrayBuilder[ClassManifest[Float]] = read(write(abu2))
check(abu2, _abu2)
-
+
// ArraySeq
val aq1 = ArraySeq(1, 2, 3)
val _aq1: ArraySeq[Int] = read(write(aq1))
check(aq1, _aq1)
-
+
// ArrayStack
val as1 = new ArrayStack[Int]
as1 ++= List(20, 2, 3).iterator
@@ -402,12 +402,12 @@ object Test3_mutable {
val wa1 = WrappedArray.make(Array(1, 2, 3))
val _wa1: WrappedArray[Int] = read(write(wa1))
check(wa1, _wa1)
-
+
// TreeSet
val ts1 = TreeSet[Int]() ++= Array(1, 2, 3)
val _ts1: TreeSet[Int] = read(write(ts1))
check(ts1, _ts1)
-
+
// concurrent.TrieMap
val ct1 = TrieMap[Int, String]() ++= Array(1 -> "one", 2 -> "two", 3 -> "three")
val _ct1: TrieMap[Int, String] = read(write(ct1))
@@ -505,7 +505,7 @@ class WithTransient extends Serializable {
@transient private lazy val a2 = 2
@transient object B extends Serializable
@transient private object C extends Serializable
-
+
def test = {
println(a1)
println(a2)
@@ -552,55 +552,55 @@ object Test {
// Test classes in package "scala.collection.parallel" and subpackages
object Test9_parallel {
import scala.collection.parallel._
-
+
try {
println()
-
+
// UnrolledBuffer
val ub = new collection.mutable.UnrolledBuffer[String]
ub ++= List("one", "two")
val _ub: collection.mutable.UnrolledBuffer[String] = read(write(ub))
check(ub, _ub)
-
+
// mutable.ParArray
val pa = mutable.ParArray("abc", "def", "etc")
val _pa: mutable.ParArray[String] = read(write(pa))
check(pa, _pa)
-
+
// mutable.ParHashMap
val mpm = mutable.ParHashMap(1 -> 2, 2 -> 4)
val _mpm: mutable.ParHashMap[Int, Int] = read(write(mpm))
check(mpm, _mpm)
-
+
// mutable.ParTrieMap
val mpc = mutable.ParTrieMap(1 -> 2, 2 -> 4)
val _mpc: mutable.ParTrieMap[Int, Int] = read(write(mpc))
check(mpc, _mpc)
-
+
// mutable.ParHashSet
val mps = mutable.ParHashSet(1, 2, 3)
val _mps: mutable.ParHashSet[Int] = read(write(mps))
check(mps, _mps)
-
+
// immutable.ParRange
val pr1 = immutable.ParRange(0, 4, 1, true)
val _pr1: immutable.ParRange = read(write(pr1))
check(pr1, _pr1)
-
+
val pr2 = immutable.ParRange(0, 4, 1, false)
val _pr2: immutable.ParRange = read(write(pr2))
check(pr2, _pr2)
-
+
// immutable.ParHashMap
val ipm = immutable.ParHashMap(5 -> 1, 10 -> 2)
val _ipm: immutable.ParHashMap[Int, Int] = read(write(ipm))
check(ipm, _ipm)
-
+
// immutable.ParHashSet
val ips = immutable.ParHashSet("one", "two")
val _ips: immutable.ParHashSet[String] = read(write(ips))
check(ips, _ips)
-
+
} catch {
case e: Exception =>
println("Error in Test5_parallel: " + e)
diff --git a/test/files/jvm/si5471.scala b/test/files/jvm/si5471.scala
index 2c8c4205c5..2efd869b61 100644
--- a/test/files/jvm/si5471.scala
+++ b/test/files/jvm/si5471.scala
@@ -4,12 +4,12 @@ object Test {
def main(args: Array[String]) {
import scala.math.Numeric
import scala.math.Numeric.Implicits._
-
+
val b = BigInt(Long.MaxValue) + 1
def dbl[N :Numeric](n: N) = n.toDouble
def flt[N :Numeric](n: N) = n.toFloat
-
+
println(dbl(b) == b.toDouble)
println(flt(b) == b.toFloat)
}
diff --git a/test/files/jvm/t1461.scala b/test/files/jvm/t1461.scala
index a963ec6a12..f0e3cea6cd 100644
--- a/test/files/jvm/t1461.scala
+++ b/test/files/jvm/t1461.scala
@@ -3,7 +3,7 @@ object Test {
def main(args: Array[String]) {
val jl = classOf[Foo].getMethod("jl", classOf[Baz[_]])
jl.getGenericParameterTypes // works fine
-
+
val l = classOf[Foo].getMethod("l", classOf[Baz[_]])
// By debugger inspection l.signature is (Ltest/Baz<J>;)V
l.getGenericParameterTypes // throws GenericSignatureFormatError
diff --git a/test/files/jvm/t1464/MyTrait.scala b/test/files/jvm/t1464/MyTrait.scala
index 014ddf86c3..0b8ccc412b 100644
--- a/test/files/jvm/t1464/MyTrait.scala
+++ b/test/files/jvm/t1464/MyTrait.scala
@@ -1,5 +1,5 @@
trait MyTrait {
type K
def findChildByClass[T <: K with MyTrait]: Unit
-
+
}
diff --git a/test/files/jvm/t1600.scala b/test/files/jvm/t1600.scala
index 69179c1ba4..5a1b2900c5 100644
--- a/test/files/jvm/t1600.scala
+++ b/test/files/jvm/t1600.scala
@@ -4,23 +4,23 @@
* changes on deserialization.
*/
object Test {
-
+
import collection._
def main(args: Array[String]) {
for (i <- Seq(0, 1, 2, 10, 100)) {
def entries = (0 until i).map(i => (new Foo, i)).toList
def elements = entries.map(_._1)
-
+
val maps = Seq[Map[Foo, Int]](new mutable.HashMap, new mutable.LinkedHashMap,
immutable.HashMap.empty).map(_ ++ entries)
test[Map[Foo, Int]](maps, entries.size, assertMap _)
-
+
val sets = Seq[Set[Foo]](new mutable.HashSet, new mutable.LinkedHashSet,
immutable.HashSet.empty).map(_ ++ elements)
test[Set[Foo]](sets, entries.size, assertSet _)
}
}
-
+
private def test[A <: AnyRef](collections: Seq[A], expectedSize: Int, assertFunction: (A, Int) => Unit) {
for (collection <- collections) {
assertFunction(collection, expectedSize)
@@ -28,19 +28,19 @@ object Test {
val bytes = toBytes(collection)
Foo.hashCodeModifier = 1
val deserializedCollection = toObject[A](bytes)
-
+
assertFunction(deserializedCollection, expectedSize)
assert(deserializedCollection.getClass == collection.getClass,
"collection class should remain the same after deserialization ("+deserializedCollection.getClass+" != "+collection.getClass+")")
Foo.hashCodeModifier = 0
}
}
-
+
private def toObject[A](bytes: Array[Byte]): A = {
val in = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(bytes))
in.readObject.asInstanceOf[A]
}
-
+
private def toBytes(o: AnyRef): Array[Byte] = {
val bos = new java.io.ByteArrayOutputStream
val out = new java.io.ObjectOutputStream(bos)
@@ -48,7 +48,7 @@ object Test {
out.close
bos.toByteArray
}
-
+
private def assertMap[A, B](map: Map[A, B], expectedSize: Int) {
assert(expectedSize == map.size, "expected map size: " + expectedSize + ", actual size: " + map.size)
map.foreach { case (k, v) =>
@@ -56,19 +56,19 @@ object Test {
assert(map(k) == v)
}
}
-
+
private def assertSet[A](set: Set[A], expectedSize: Int) {
assert(expectedSize == set.size, "expected set size: " + expectedSize + ", actual size: " + set.size)
set.foreach { e => assert(set.contains(e), "contains should return true for element in the set, element: " + e) }
}
-
+
object Foo {
- /* Used to simulate a hashCode change caused by deserializing an instance with an
+ /* Used to simulate a hashCode change caused by deserializing an instance with an
* identity-based hashCode in another JVM.
*/
var hashCodeModifier = 0
}
-
+
class Foo extends Serializable {
override def hashCode = System.identityHashCode(this) + Foo.hashCodeModifier
}
diff --git a/test/files/jvm/t2570/Test.scala b/test/files/jvm/t2570/Test.scala
index f1cba53546..ad4d29dd7f 100644
--- a/test/files/jvm/t2570/Test.scala
+++ b/test/files/jvm/t2570/Test.scala
@@ -1,3 +1,3 @@
class Test2 extends Test1[Test3[Test4]]
class Test4
-object Test extends App {} \ No newline at end of file
+object Test extends App {} \ No newline at end of file
diff --git a/test/files/jvm/t3003/Test_1.scala b/test/files/jvm/t3003/Test_1.scala
index 38af66a25a..8ec08bebc6 100644
--- a/test/files/jvm/t3003/Test_1.scala
+++ b/test/files/jvm/t3003/Test_1.scala
@@ -9,7 +9,7 @@ object Test {
. map(f => f.getAnnotations.toList)
. filterNot (_.isEmpty) // there are extra fields under -Xcheckinit
)
-
+
println(xs)
}
}
diff --git a/test/files/jvm/throws-annot.scala b/test/files/jvm/throws-annot.scala
index b679b6c121..90b58b9976 100644
--- a/test/files/jvm/throws-annot.scala
+++ b/test/files/jvm/throws-annot.scala
@@ -43,24 +43,24 @@ object TestThrows {
/** Test the top-level mirror that is has the annotations. */
object TL {
-
+
@throws(classOf[IOException])
def read(): Int = 0
-
+
@throws(classOf[ClassCastException])
@throws(classOf[IOException])
def readWith2(): Int = 0
-
+
@throws(classOf[IOException])
@Deprecated
@throws(classOf[NullPointerException])
def readMixed(): Int = 0
-
+
@Deprecated
@throws(classOf[IOException])
@throws(classOf[NullPointerException])
def readMixed2(): Int = 0
-
+
@Deprecated
def readNoEx(): Int = 0
}
diff --git a/test/files/jvm/typerep.scala b/test/files/jvm/typerep.scala
index 47bd16a467..1d6f0b7907 100644
--- a/test/files/jvm/typerep.scala
+++ b/test/files/jvm/typerep.scala
@@ -109,7 +109,7 @@ object testFuncs {
def f5(f: Int => Int, x: Int) = f(x)
println(getType(f5 _))
println(getType(f5(f1, 1)))
- println
+ println
}
class Foo {
diff --git a/test/files/jvm/unittest_io_Jvm.check b/test/files/jvm/unittest_io_Jvm.check
index d6e855f939..bcfce8cbdb 100644
--- a/test/files/jvm/unittest_io_Jvm.check
+++ b/test/files/jvm/unittest_io_Jvm.check
@@ -1,5 +1,5 @@
lines.size = 5
-
+
This is a file
it is split on several lines.
diff --git a/test/files/jvm/unittest_io_Jvm.scala b/test/files/jvm/unittest_io_Jvm.scala
index 1484774fb3..7c8ef131bc 100644
--- a/test/files/jvm/unittest_io_Jvm.scala
+++ b/test/files/jvm/unittest_io_Jvm.scala
@@ -3,7 +3,7 @@ import scala.io.Source
object Test {
def main(args: Array[String]) {
val lines = Source.fromString(
- """|
+ """|
|This is a file
|it is split on several lines.
|
diff --git a/test/files/jvm/unreachable/Foo_1.scala b/test/files/jvm/unreachable/Foo_1.scala
index c223718097..600b96bb18 100644
--- a/test/files/jvm/unreachable/Foo_1.scala
+++ b/test/files/jvm/unreachable/Foo_1.scala
@@ -65,7 +65,7 @@ class Foo_1 {
return 42
} catch {
case x: Throwable => return 2
- }
+ }
return 3
}
@@ -74,7 +74,7 @@ class Foo_1 {
error("haha")
} catch {
case x: Throwable => return 42
- }
+ }
return 3
}
diff --git a/test/files/jvm/varargs/JavaClass.java b/test/files/jvm/varargs/JavaClass.java
index 536e9a38fb..9851e1b78b 100644
--- a/test/files/jvm/varargs/JavaClass.java
+++ b/test/files/jvm/varargs/JavaClass.java
@@ -4,7 +4,7 @@
public class JavaClass {
public static <T> void varargz(int i, T... v) {
}
-
+
public static void callSomeAnnotations() {
VaClass va = new VaClass();
va.vs(4, "", "", "");
diff --git a/test/files/jvm/varargs/VaClass.scala b/test/files/jvm/varargs/VaClass.scala
index 8e9cbdbb3f..6343f9c6f6 100644
--- a/test/files/jvm/varargs/VaClass.scala
+++ b/test/files/jvm/varargs/VaClass.scala
@@ -5,9 +5,9 @@ import annotation.varargs
class VaClass {
-
+
@varargs def vs(a: Int, b: String*) = println(a + b.length)
@varargs def vi(a: Int, b: Int*) = println(a + b.sum)
@varargs def vt[T](a: Int, b: T*) = println(a + b.length)
-
+
}
diff --git a/test/files/jvm/xml05.check b/test/files/jvm/xml05.check
index 8d3e803bc8..92ea995350 100644
--- a/test/files/jvm/xml05.check
+++ b/test/files/jvm/xml05.check
@@ -1,11 +1,7 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala>
-
scala> <city name="San Jos&eacute;"/>
res0: scala.xml.Elem = <city name="San Jos&eacute;"/>
scala>
-
-scala>