summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJosh Suereth <Joshua.Suereth@gmail.com>2012-10-11 05:22:27 -0700
committerJosh Suereth <Joshua.Suereth@gmail.com>2012-10-11 05:22:27 -0700
commit90c7596c0736d56ff7b8d699bd958d28cb213bdf (patch)
tree5f76ed86c3d31606c5dd03dc6d5d57cc5b0b05b5 /test
parent1d8469d5ddf1b9ae4addd5c8a69cf08db470e143 (diff)
parent19ea47b3425f973c1ca92890cb8ee561b0ecab3d (diff)
downloadscala-90c7596c0736d56ff7b8d699bd958d28cb213bdf.tar.gz
scala-90c7596c0736d56ff7b8d699bd958d28cb213bdf.tar.bz2
scala-90c7596c0736d56ff7b8d699bd958d28cb213bdf.zip
Merge pull request #1487 from dragos/issue/fix-6505
Fixed SI-6505. Respond to ask calls by immediate failure after compiler shutdown.
Diffstat (limited to 'test')
-rw-r--r--test/files/presentation/forgotten-ask.scala33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/files/presentation/forgotten-ask.scala b/test/files/presentation/forgotten-ask.scala
new file mode 100644
index 0000000000..358dd75e98
--- /dev/null
+++ b/test/files/presentation/forgotten-ask.scala
@@ -0,0 +1,33 @@
+import scala.tools.nsc.interactive._
+import tests._
+
+/** Test that no ask calls are left unanswered after a compiler has shut down. */
+object Test extends InteractiveTest {
+ import compiler._
+
+ def askItem(): Response[Unit] = {
+ compiler.askForResponse { () =>
+ Thread.sleep(100)
+ }
+ }
+
+ final val Timeout = 5000 //ms
+
+ override def main(args: Array[String]) {
+ val item1 = askItem()
+
+ compiler.askShutdown()
+
+ Thread.sleep(1000) // wait a bit, the compiler is shutting down
+ val item2 = askItem()
+
+ item1.get(Timeout) match {
+ case None => println("TIMEOUT")
+ case _ =>
+ }
+ item2.get(Timeout) match {
+ case None => println("TIMEOUT")
+ case _ =>
+ }
+ }
+} \ No newline at end of file