summaryrefslogtreecommitdiff
path: root/test/files/jvm
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/jvm')
-rw-r--r--test/files/jvm/actor-exceptions.check4
-rw-r--r--test/files/jvm/actor-exceptions.scala8
-rw-r--r--test/files/jvm/actor-link-getstate.check3
-rw-r--r--test/files/jvm/actor-uncaught-exception.check7
-rw-r--r--test/files/jvm/actor-uncaught-exception.scala1
-rw-r--r--test/files/jvm/actor-uncaught-exception2.scala1
-rw-r--r--test/files/jvm/annotations.scala3
-rw-r--r--test/files/jvm/t3356.check1
-rw-r--r--test/files/jvm/t3356.scala54
-rw-r--r--test/files/jvm/t3365.check5
-rw-r--r--test/files/jvm/t3365.scala65
11 files changed, 138 insertions, 14 deletions
diff --git a/test/files/jvm/actor-exceptions.check b/test/files/jvm/actor-exceptions.check
index bd44b968cc..d86bac9de5 100644
--- a/test/files/jvm/actor-exceptions.check
+++ b/test/files/jvm/actor-exceptions.check
@@ -1,3 +1 @@
-Uncaught exception in Slave
-Message: A
-MyOtherException
+OK
diff --git a/test/files/jvm/actor-exceptions.scala b/test/files/jvm/actor-exceptions.scala
index 384226d777..3ee4db9ed2 100644
--- a/test/files/jvm/actor-exceptions.scala
+++ b/test/files/jvm/actor-exceptions.scala
@@ -19,6 +19,7 @@ object Master extends Actor {
for (i <- 0 until 10) Slave ! A
react {
case Exit(from, reason) =>
+ println("OK")
}
} catch {
case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] =>
@@ -31,6 +32,7 @@ object Slave extends Actor {
override def toString = "Slave"
override def exceptionHandler: PartialFunction[Exception, Unit] = {
case MyException(text) =>
+ case other if !other.isInstanceOf[scala.util.control.ControlThrowable] => super.exceptionHandler(other)
}
def act() {
try {
@@ -41,12 +43,14 @@ object Slave extends Actor {
cnt += 1
if (cnt % 2 != 0) throw MyException("problem")
if (cnt == 10) {
- throw new MyOtherException("unhandled")
+ throw MyOtherException("unhandled")
}
}
}
} catch {
- case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] =>
+ case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] &&
+ !e.isInstanceOf[MyException] &&
+ !e.isInstanceOf[MyOtherException] =>
e.printStackTrace()
}
}
diff --git a/test/files/jvm/actor-link-getstate.check b/test/files/jvm/actor-link-getstate.check
index 45967222e6..9755447320 100644
--- a/test/files/jvm/actor-link-getstate.check
+++ b/test/files/jvm/actor-link-getstate.check
@@ -1,5 +1,2 @@
Done
-Uncaught exception in Master
-Message: 'done
-MyException: Master crashed
Terminated
diff --git a/test/files/jvm/actor-uncaught-exception.check b/test/files/jvm/actor-uncaught-exception.check
index 3e669779df..2c94e48371 100644
--- a/test/files/jvm/actor-uncaught-exception.check
+++ b/test/files/jvm/actor-uncaught-exception.check
@@ -1,5 +1,2 @@
-Uncaught exception in StartError
-MyException: I don't want to run!
-Uncaught exception in MessageError
-Message: 'ping
-MyException: No message for me!
+OK
+OK
diff --git a/test/files/jvm/actor-uncaught-exception.scala b/test/files/jvm/actor-uncaught-exception.scala
index 9dbd36dd82..882362272d 100644
--- a/test/files/jvm/actor-uncaught-exception.scala
+++ b/test/files/jvm/actor-uncaught-exception.scala
@@ -43,6 +43,7 @@ object Test {
Actor.loop {
react {
case Exit(actor, reason) =>
+ println("OK")
if (actor == StartError)
MessageError ! 'ping
else
diff --git a/test/files/jvm/actor-uncaught-exception2.scala b/test/files/jvm/actor-uncaught-exception2.scala
index 626ce5da92..36b6f0c52e 100644
--- a/test/files/jvm/actor-uncaught-exception2.scala
+++ b/test/files/jvm/actor-uncaught-exception2.scala
@@ -58,7 +58,6 @@ object Test {
}
def main(args: Array[String]) {
- Debug.level = 1 // decrease level so that it does not print warnings
Supervisor.start()
}
}
diff --git a/test/files/jvm/annotations.scala b/test/files/jvm/annotations.scala
index 227bd919c1..12760beb4e 100644
--- a/test/files/jvm/annotations.scala
+++ b/test/files/jvm/annotations.scala
@@ -160,6 +160,9 @@ object Test5 {
}
}
+// #3345
+class A3345(@volatile private var i:Int)
+
object Test {
def main(args: Array[String]) {
Test1.run
diff --git a/test/files/jvm/t3356.check b/test/files/jvm/t3356.check
new file mode 100644
index 0000000000..6a9284d0aa
--- /dev/null
+++ b/test/files/jvm/t3356.check
@@ -0,0 +1 @@
+sending download requests
diff --git a/test/files/jvm/t3356.scala b/test/files/jvm/t3356.scala
new file mode 100644
index 0000000000..5626281e7d
--- /dev/null
+++ b/test/files/jvm/t3356.scala
@@ -0,0 +1,54 @@
+import scala.actors.{Actor, Exit, !, UncaughtException}
+import Actor._
+
+case class ImageInfo(text: String) {
+ def downloadImage(): ImageData = {
+ ImageData(text)
+ }
+}
+
+case class ImageData(text: String)
+case class Download(info: ImageInfo)
+
+object Test {
+
+ def scanForImageInfo(url: String): List[ImageInfo] =
+ List(ImageInfo("A"), ImageInfo("B"))
+
+ def renderImage(data: ImageData) {
+ println("rendering image "+data.text)
+ }
+
+ def renderImages(url: String) {
+ val imageInfos = scanForImageInfo(url)
+ println("sending download requests")
+ val dataFutures = for (info <- imageInfos) yield {
+ val loader = link {
+ react { case Download(info) =>
+ throw new Exception("no connection")
+ reply(info.downloadImage())
+ }; {}
+ }
+ loader !! Download(info)
+ }
+ var i = 0
+ loopWhile (i < imageInfos.size) {
+ i += 1
+ val FutureInput = dataFutures(i-1).inputChannel
+ react {
+ case FutureInput ! (data @ ImageData(_)) =>
+ renderImage(data)
+ case Exit(from, UncaughtException(_, Some(Download(info)), _, _, cause)) =>
+ println("Couldn't download image "+info+" because of "+cause)
+ }
+ }
+ println("OK, all images rendered.")
+ }
+
+ def main(args: Array[String]) {
+ actor {
+ renderImages("panorama.epfl.ch")
+ }
+ }
+
+}
diff --git a/test/files/jvm/t3365.check b/test/files/jvm/t3365.check
new file mode 100644
index 0000000000..0944b17279
--- /dev/null
+++ b/test/files/jvm/t3365.check
@@ -0,0 +1,5 @@
+'hello
+'hello
+'hello
+'hello
+'hello
diff --git a/test/files/jvm/t3365.scala b/test/files/jvm/t3365.scala
new file mode 100644
index 0000000000..b94e804e63
--- /dev/null
+++ b/test/files/jvm/t3365.scala
@@ -0,0 +1,65 @@
+import scala.actors.{ReplyReactor, Channel, Actor, Future}
+
+case class ChannelMsg(chan: Channel[Any])
+
+class MyActor extends Actor {
+ def act() {
+ try {
+ val chan = new Channel[Any](this)
+ loop {
+ react {
+ case other: ReplyReactor =>
+ other ! ChannelMsg(chan)
+ loop {
+ chan.react {
+ case 'hello =>
+ reply('hello)
+ case 'stop =>
+ exit()
+ }
+ }
+ }
+ }
+ } catch {
+ case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] =>
+ e.printStackTrace()
+ }
+ }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ val a = new MyActor
+ a.start()
+
+ val b = new Actor {
+ def act() {
+ try {
+ react {
+ case ChannelMsg(c) =>
+ var i = 0
+ loop {
+ i += 1
+ val ft: Future[Any] = c !! 'hello
+ ft.inputChannel.react {
+ case msg =>
+ if (i % 10000 == 0)
+ println(msg)
+ if (i >= 50000) {
+ c ! 'stop
+ exit()
+ }
+ }
+ }
+ }
+ } catch {
+ case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] =>
+ e.printStackTrace()
+ }
+ }
+ }
+ b.start()
+
+ a ! b
+ }
+}