diff options
author | Philipp Haller <hallerp@gmail.com> | 2010-04-12 12:02:51 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2010-04-12 12:02:51 +0000 |
commit | 08496424f2df9baf9d3612ed2f1bdb2553e7bfd6 (patch) | |
tree | 931fa0cccd3f72f84d874dac94f326ef99d0d4d5 /test/files/jvm | |
parent | 9cf7f2c71fb0044950826a4458cb0761f6d09d8f (diff) | |
download | scala-08496424f2df9baf9d3612ed2f1bdb2553e7bfd6.tar.gz scala-08496424f2df9baf9d3612ed2f1bdb2553e7bfd6.tar.bz2 scala-08496424f2df9baf9d3612ed2f1bdb2553e7bfd6.zip |
Another test for see #2017. No review.
Diffstat (limited to 'test/files/jvm')
-rw-r--r-- | test/files/jvm/actor-uncaught-exception2.check | 2 | ||||
-rw-r--r-- | test/files/jvm/actor-uncaught-exception2.scala | 48 |
2 files changed, 50 insertions, 0 deletions
diff --git a/test/files/jvm/actor-uncaught-exception2.check b/test/files/jvm/actor-uncaught-exception2.check new file mode 100644 index 0000000000..870a5d32f9 --- /dev/null +++ b/test/files/jvm/actor-uncaught-exception2.check @@ -0,0 +1,2 @@ +UncaughtException(StartError,None,None,MyException: I don't want to run!) +UncaughtException(MessageError,Some('ping),Some(Supervisor),MyException: No message for me!) diff --git a/test/files/jvm/actor-uncaught-exception2.scala b/test/files/jvm/actor-uncaught-exception2.scala new file mode 100644 index 0000000000..973cfb370a --- /dev/null +++ b/test/files/jvm/actor-uncaught-exception2.scala @@ -0,0 +1,48 @@ +import scala.actors.{Actor, Exit, Debug} + +class MyException(msg: String) extends Exception(msg) { + override def fillInStackTrace() = this +} + +object Test { + + case object StartError extends Actor { + def act() { + throw new MyException("I don't want to run!") + } + } + + case object MessageError extends Actor { + def act() { + react { + case _ => throw new MyException("No message for me!") + } + } + } + + case object Supervisor extends Actor { + def act() { + trapExit = true + link(StartError) + link(MessageError) + StartError.start() + MessageError.start() + + Actor.loop { + react { + case Exit(actor, reason) => + println(reason) + if (actor == StartError) + MessageError ! 'ping + else + exit() + } + } + } + } + + def main(args: Array[String]) { + Debug.level = 1 // decrease level so that it does not print warnings + Supervisor.start() + } +} |