Skip to content
This repository was archived by the owner on Sep 8, 2022. It is now read-only.

Commit 19bfc74

Browse files
gourlaysamaszeiger
authored andcommitted
improve mapping from partest's TestState to sbt's Status.
1 parent 7c9a535 commit 19bfc74

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/main/scala/scala/tools/partest/nest/SBTRunner.scala

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import sbt.testing.OptionalThrowable
1919
import sbt.testing.SuiteSelector
2020
import sbt.testing.TestSelector
2121
import java.net.URLClassLoader
22+
import TestState._
2223

2324
// called reflectively from scala-partest-test-interface
2425
class SBTRunner(partestFingerprint: Fingerprint, eventHandler: EventHandler, loggers: Array[Logger],
@@ -42,11 +43,19 @@ class SBTRunner(partestFingerprint: Fingerprint, eventHandler: EventHandler, log
4243
def fullyQualifiedName: String = testFile.testIdent
4344
def fingerprint: Fingerprint = partestFingerprint
4445
def selector: Selector = new TestSelector(testFile.testIdent)
45-
def status: Status = if (result.isOk) Status.Success else Status.Failure
46-
def throwable: OptionalThrowable = new OptionalThrowable
46+
val (status, throwable) = makeStatus(result)
4747
def duration: Long = -1
4848
})
4949
result
5050
}
5151
}
52+
53+
def makeStatus(t: TestState): (Status, OptionalThrowable) = t match {
54+
case _: Uninitialized => (Status.Pending, new OptionalThrowable)
55+
case _: Pass => (Status.Success, new OptionalThrowable)
56+
case _: Updated => (Status.Success, new OptionalThrowable)
57+
case _: Skip => (Status.Skipped, new OptionalThrowable)
58+
case _: Fail => (Status.Failure, new OptionalThrowable)
59+
case Crash(_,e,_) => (Status.Error, new OptionalThrowable(e))
60+
}
5261
}

0 commit comments

Comments
 (0)