Skip to content

Commit 565a2e5

Browse files
committed
When a test fails report number of _failures_ not _errors_ (V2)
Right now we report the number of "errors", that is compiler errors including the expected ones, but we should instead use the test "failures", that is the unexpected behaviors. Also make errorCount private.
1 parent df78c3c commit 565a2e5

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
227227
val sourceCount = filteredSources.length
228228

229229
private[this] var _errorCount = 0
230-
def errorCount: Int = _errorCount
230+
/** Number of (expected or unexpected) compiler errors. Unlikely to be what you want, use `failureCount` instead. */
231+
private[this] def errorCount: Int = _errorCount
231232

232233
private[this] var _testSourcesCompleted = 0
233234
private def testSourcesCompleted: Int = _testSourcesCompleted
@@ -1012,11 +1013,11 @@ trait ParallelTesting extends RunnerOrchestration { self =>
10121013

10131014
/** Extract `Failure` set and render from `Test` */
10141015
private[this] def reasonsForFailure(test: Test): String = {
1015-
val errors =
1016-
if (test.errorCount == 0) ""
1017-
else s"\n - encountered ${test.errorCount} error(s)"
1016+
val failureReport =
1017+
if (test.failureCount == 0) ""
1018+
else s"\n - encountered ${test.failureCount} test failures(s)"
10181019

1019-
errors + test.failureReasons.collect {
1020+
failureReport + test.failureReasons.collect {
10201021
case test.TimeoutFailure(title) =>
10211022
s" - test '$title' timed out"
10221023
case test.JavaCompilationFailure(msg) =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class VulpixUnitTests extends ParallelTesting {
9191
fail()
9292
} catch {
9393
case ae: AssertionError =>
94-
assertEquals(ae.getMessage, "Run test failed, but should not, reasons:\n - test 'tests/vulpix-tests/unit/timeout.scala' timed out")
94+
assertEquals(ae.getMessage, "Run test failed, but should not, reasons:\n\n - encountered 1 test failures(s) - test 'tests/vulpix-tests/unit/timeout.scala' timed out")
9595
}
9696
}
9797
}

0 commit comments

Comments
 (0)