aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-03-14 21:28:13 -0500
committerJesse Luehrs <doy@tozt.net>2013-03-14 21:28:13 -0500
commit761f40d02ce336fa811265e9fe14b12f4c50cf21 (patch)
tree2b525bca3d1bdc8aeea3a8d010eb4297c36dd50f
parente744a379caac8e1a6340bba97310531332868ef9 (diff)
downloadscala-test-more-761f40d02ce336fa811265e9fe14b12f4c50cf21.tar.gz
scala-test-more-761f40d02ce336fa811265e9fe14b12f4c50cf21.zip
fix exceptions hanging the report summarizer
-rw-r--r--src/main/scala/com/iinteractive/test/harness/SummarizedTests.scala30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/main/scala/com/iinteractive/test/harness/SummarizedTests.scala b/src/main/scala/com/iinteractive/test/harness/SummarizedTests.scala
index df20472..1932af0 100644
--- a/src/main/scala/com/iinteractive/test/harness/SummarizedTests.scala
+++ b/src/main/scala/com/iinteractive/test/harness/SummarizedTests.scala
@@ -5,6 +5,7 @@ import scala.concurrent.Await
import scala.concurrent.duration.Duration
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
+import scala.util.{Try,Success,Failure}
import com.iinteractive.test.tap.{Parser,TAPEvent,TAPResult,TodoDirective}
import com.iinteractive.test.Test
@@ -31,24 +32,33 @@ trait SummarizedTests {
val err = if (combine) out else Console.err
val testFuture = Future {
- Console.withOut(out) {
- Console.withErr(err) {
- if (combine) {
- test.run
- }
- else {
- test.runInHarness
+ val result = Try {
+ Console.withOut(out) {
+ Console.withErr(err) {
+ if (combine) {
+ test.run
+ }
+ else {
+ test.runInHarness
+ }
}
}
}
out.close
+ result
}
val parser = new Parser(cb)
- val result = parser.parse(in)
+ val result = Try(parser.parse(in))
in.close
- Await.ready(testFuture, Duration.Inf)
+ Await.result(testFuture, Duration.Inf) match {
+ case Success(_) => ()
+ case Failure(e) => throw e
+ }
- result
+ result match {
+ case Success(r) => r
+ case Failure(e) => throw e
+ }
}
}