Skip to content

Commit

Permalink
Vulpix: Introduce WarnTest/checkWarnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Sep 4, 2023
1 parent 845bb1c commit 4740017
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ class CompilationTests {
).times(2).checkCompile()
}

// Warning tests ------------------------------------------------------------

@Test def warn: Unit = {
implicit val testGroup: TestGroup = TestGroup("compileWarn")
aggregateTests(
compileFilesInDir("tests/warn", defaultOptions),
).checkWarnings()
}

// Negative tests ------------------------------------------------------------

@Test def negAll: Unit = {
Expand Down
9 changes: 9 additions & 0 deletions compiler/test/dotty/tools/vulpix/ParallelTesting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,12 @@ trait ParallelTesting extends RunnerOrchestration { self =>
private final class PosTest(testSources: List[TestSource], times: Int, threadLimit: Option[Int], suppressAllOutput: Boolean)(implicit summaryReport: SummaryReporting)
extends Test(testSources, times, threadLimit, suppressAllOutput)

private final class WarnTest(testSources: List[TestSource], times: Int, threadLimit: Option[Int], suppressAllOutput: Boolean)(implicit summaryReport: SummaryReporting)
extends Test(testSources, times, threadLimit, suppressAllOutput):
override def suppressErrors = true
override def onSuccess(testSource: TestSource, reporters: Seq[TestReporter], logger: LoggedRunnable): Unit =
diffCheckfile(testSource, reporters, logger)

private final class RewriteTest(testSources: List[TestSource], checkFiles: Map[JFile, JFile], times: Int, threadLimit: Option[Int], suppressAllOutput: Boolean)(implicit summaryReport: SummaryReporting)
extends Test(testSources, times, threadLimit, suppressAllOutput) {
private def verifyOutput(testSource: TestSource, reporters: Seq[TestReporter], logger: LoggedRunnable) = {
Expand Down Expand Up @@ -1020,6 +1026,9 @@ trait ParallelTesting extends RunnerOrchestration { self =>
def checkCompile()(implicit summaryReport: SummaryReporting): this.type =
checkPass(new PosTest(targets, times, threadLimit, shouldFail || shouldSuppressOutput), "Pos")

def checkWarnings()(implicit summaryReport: SummaryReporting): this.type =
checkPass(new WarnTest(targets, times, threadLimit, shouldFail || shouldSuppressOutput), "Warn")

/** Creates a "neg" test run, which makes sure that each test generates the
* correct number of errors at the correct positions. It also makes sure
* that none of these tests crashes the compiler.
Expand Down

0 comments on commit 4740017

Please sign in to comment.