summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPhilipp Haller <hallerp@gmail.com>2010-05-25 14:58:42 +0000
committerPhilipp Haller <hallerp@gmail.com>2010-05-25 14:58:42 +0000
commit4b10a4ca64f3d96a33a7f7badbf2a74e1c176fc4 (patch)
tree52b5047b7cfb01993c5ab674ab0520ef9da6ce3c /test
parent5628970b43eefcd892320941ea6f937a7ce09b6a (diff)
downloadscala-4b10a4ca64f3d96a33a7f7badbf2a74e1c176fc4.tar.gz
scala-4b10a4ca64f3d96a33a7f7badbf2a74e1c176fc4.tar.bz2
scala-4b10a4ca64f3d96a33a7f7badbf2a74e1c176fc4.zip
Addresses see #3470 by adding a method Reactor....
Addresses see #3470 by adding a method Reactor.restart. Review by rompf.
Diffstat (limited to 'test')
-rw-r--r--test/files/jvm/t3470.check3
-rw-r--r--test/files/jvm/t3470.scala30
2 files changed, 33 insertions, 0 deletions
diff --git a/test/files/jvm/t3470.check b/test/files/jvm/t3470.check
new file mode 100644
index 0000000000..94cb526756
--- /dev/null
+++ b/test/files/jvm/t3470.check
@@ -0,0 +1,3 @@
+A: started: 1
+A: started: 2
+A: started: 3
diff --git a/test/files/jvm/t3470.scala b/test/files/jvm/t3470.scala
new file mode 100644
index 0000000000..5e4242cdd7
--- /dev/null
+++ b/test/files/jvm/t3470.scala
@@ -0,0 +1,30 @@
+import scala.actors._
+
+object Test {
+
+ def expectActorState(a: Reactor[T] forSome { type T }, s: Actor.State.Value) {
+ var done = false
+ var i = 0
+ while (!done) {
+ i = i + 1
+ if (i == 10) { // only wait for 2 seconds total
+ println("FAIL ["+a+": expected "+s+"]")
+ done = true
+ }
+
+ Thread.sleep(200)
+ if (a.getState == s) // success
+ done = true
+ }
+ }
+
+ def main(args: Array[String]) {
+ val a = new Actor { var c = 0; def act() = { c += 1; println("A: started: " + c) } }
+ a.start()
+ expectActorState(a, Actor.State.Terminated)
+ a.restart()
+ expectActorState(a, Actor.State.Terminated)
+ a.restart()
+ }
+
+}