From e630619482d67c7a1ac57d6e70b5219b7d11255d Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Mon, 14 Jan 2013 11:27:27 -0700 Subject: [PATCH] update tap protocol version to 13 --- README.md | 2 +- src/main/scala/SbtTapReporting.scala | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 380fd9e..c0c6d9d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ This sbt plug-in provides reporting of test success and failure for tests run by [simple build tool](https://github.com/sbt/sbt) -in [TAP](http://search.cpan.org/perldoc?Test%3A%3AHarness%3A%3ATAP) format. +in [TAP](http://search.cpan.org/perldoc?TAP%3A%3AParser%3A%3AGrammar) format. All the test results will be generated in one file, the path of which may be specified in the `SBT_TAP_OUTPUT` environment variable. If unspecified in the diff --git a/src/main/scala/SbtTapReporting.scala b/src/main/scala/SbtTapReporting.scala index eb6eac4..20b1130 100644 --- a/src/main/scala/SbtTapReporting.scala +++ b/src/main/scala/SbtTapReporting.scala @@ -25,6 +25,7 @@ class SbtTapListener extends TestsListener { val file = new File(filename) new File(file.getParent).mkdirs fileWriter = new FileWriter(file) + writeTap("TAP", "version", 13) } def startGroup(name: String) = @@ -40,15 +41,16 @@ class SbtTapListener extends TestsListener { def testEvent(event: TestEvent) = { event.detail.foreach { e: TEvent => + val description = e.testName.replaceAll("#", "%23") e.result match { - case TResult.Success => writeTap("ok", testId.incrementAndGet, "-", e.testName) + case TResult.Success => + writeTap("ok", testId.incrementAndGet, "-", description) + case TResult.Skipped => + writeTap("ok", testId.incrementAndGet, "-", description, "# SKIP") case TResult.Error | TResult.Failure => - writeTap("not ok", testId.incrementAndGet, "-", e.testName) + writeTap("not ok", testId.incrementAndGet, "-", description) // TODO: It would be nice if we could report the exact line in the test where this happened. writeTapDiag(stackTraceForError(e.error)) - case TResult.Skipped => - // it doesn't look like this framework distinguishes between pending and ignored. - writeTap("ok", testId.incrementAndGet, e.testName, "#", "skip", e.testName) } } } -- 2.43.0