Skip to content

Commit 006188e

Browse files
committed
Count multiple test failures correctly
We can't use `_failures.size` since it's a Set. Using a `Seq` for now would be pointless, since most elements are just `Generic` failures, but would have a point if we wanted to show info on those failures in the final log.
1 parent 4a98aa0 commit 006188e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,17 +240,20 @@ trait ParallelTesting extends RunnerOrchestration { self =>
240240
case object Generic extends Failure
241241

242242
private[this] var _failures = Set.empty[Failure]
243+
private[this] var _failureCount = 0
244+
243245
/** Fail the current test */
244246
protected[this] final def fail(failure: Failure = Generic): Unit = synchronized {
245247
_failures = _failures + failure
248+
_failureCount = _failureCount + 1
246249
}
247-
def didFail: Boolean = _failures.nonEmpty
250+
def didFail: Boolean = _failureCount != 0
248251

249252
/** A set of the different failures */
250253
def failureReasons: Set[Failure] = _failures
251254

252255
/** Number of failed tests */
253-
def failureCount: Int = _failures.size
256+
def failureCount: Int = _failureCount
254257

255258
protected def logBuildInstructions(reporter: TestReporter, testSource: TestSource, err: Int, war: Int) = {
256259
val errorMsg = testSource.buildInstructions(reporter.errorCount, reporter.warningCount)

0 commit comments

Comments
 (0)