Skip to content

Commit b78a377

Browse files
dwijnandWojciechMazur
authored andcommitted
Vulpix: Introduce WarnTest/checkWarnings
[Cherry-picked 4740017]
1 parent aa50cd3 commit b78a377

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,15 @@ class CompilationTests {
108108
).times(2).checkCompile()
109109
}
110110

111+
// Warning tests ------------------------------------------------------------
112+
113+
@Test def warn: Unit = {
114+
implicit val testGroup: TestGroup = TestGroup("compileWarn")
115+
aggregateTests(
116+
compileFilesInDir("tests/warn", defaultOptions),
117+
).checkWarnings()
118+
}
119+
111120
// Negative tests ------------------------------------------------------------
112121

113122
@Test def negAll: Unit = {

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,12 @@ trait ParallelTesting extends RunnerOrchestration { self =>
723723
private final class PosTest(testSources: List[TestSource], times: Int, threadLimit: Option[Int], suppressAllOutput: Boolean)(implicit summaryReport: SummaryReporting)
724724
extends Test(testSources, times, threadLimit, suppressAllOutput)
725725

726+
private final class WarnTest(testSources: List[TestSource], times: Int, threadLimit: Option[Int], suppressAllOutput: Boolean)(implicit summaryReport: SummaryReporting)
727+
extends Test(testSources, times, threadLimit, suppressAllOutput):
728+
override def suppressErrors = true
729+
override def onSuccess(testSource: TestSource, reporters: Seq[TestReporter], logger: LoggedRunnable): Unit =
730+
diffCheckfile(testSource, reporters, logger)
731+
726732
private final class RewriteTest(testSources: List[TestSource], checkFiles: Map[JFile, JFile], times: Int, threadLimit: Option[Int], suppressAllOutput: Boolean)(implicit summaryReport: SummaryReporting)
727733
extends Test(testSources, times, threadLimit, suppressAllOutput) {
728734
private def verifyOutput(testSource: TestSource, reporters: Seq[TestReporter], logger: LoggedRunnable) = {
@@ -1020,6 +1026,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
10201026
def checkCompile()(implicit summaryReport: SummaryReporting): this.type =
10211027
checkPass(new PosTest(targets, times, threadLimit, shouldFail || shouldSuppressOutput), "Pos")
10221028

1029+
def checkWarnings()(implicit summaryReport: SummaryReporting): this.type =
1030+
checkPass(new WarnTest(targets, times, threadLimit, shouldFail || shouldSuppressOutput), "Warn")
1031+
10231032
/** Creates a "neg" test run, which makes sure that each test generates the
10241033
* correct number of errors at the correct positions. It also makes sure
10251034
* that none of these tests crashes the compiler.

0 commit comments

Comments
 (0)