diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-02-28 17:34:53 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-02-28 17:41:04 -0600 |
commit | aa7bafe18b07e91af4afb96d1e3fc08479d897fb (patch) | |
tree | 802e3a1bacffa93f903a16770d9b2960ce9dacb2 /src/main/scala/org/perl8/test/harness/SummarizedTests.scala | |
parent | 7bf64f5b97e344de3a35aa2e4fb9dc1d2a8c4b0c (diff) | |
download | scala-test-more-aa7bafe18b07e91af4afb96d1e3fc08479d897fb.tar.gz scala-test-more-aa7bafe18b07e91af4afb96d1e3fc08479d897fb.zip |
factor some stuff out of SummaryReporter
Diffstat (limited to 'src/main/scala/org/perl8/test/harness/SummarizedTests.scala')
-rw-r--r-- | src/main/scala/org/perl8/test/harness/SummarizedTests.scala | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main/scala/org/perl8/test/harness/SummarizedTests.scala b/src/main/scala/org/perl8/test/harness/SummarizedTests.scala new file mode 100644 index 0000000..afa5f41 --- /dev/null +++ b/src/main/scala/org/perl8/test/harness/SummarizedTests.scala @@ -0,0 +1,32 @@ +package org.perl8.test.harness + +import java.io.{PipedInputStream,PipedOutputStream} +import scala.concurrent.Await +import scala.concurrent.duration.Duration +import scala.concurrent.ExecutionContext.Implicits.global +import scala.concurrent.Future + +import org.perl8.test.tap.Consumer.{TAPResult,TodoDirective} +import org.perl8.test.tap._ +import org.perl8.test.Test + +trait SummarizedTests { + def runOneTest (test: Test, cb: TAPEvent => Unit): TAPResult = { + val out = new PipedOutputStream + val in = new PipedInputStream(out) + + val testFuture = Future { + Console.withOut(out) { + test.runInHarness + } + out.close + } + + val parser = new Parser(cb) + val result = parser.parse(in) + in.close + Await.ready(testFuture, Duration.Inf) + + result + } +} |