Skip to content

Commit 4740017

Browse files
committed
Vulpix: Introduce WarnTest/checkWarnings
1 parent 845bb1c commit 4740017

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

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

+9
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,15 @@ class CompilationTests {
109109
).times(2).checkCompile()
110110
}
111111

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

114123
@Test def negAll: Unit = {

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

+9
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)