aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/test/CompilerTest.scala25
1 files changed, 20 insertions, 5 deletions
diff --git a/test/test/CompilerTest.scala b/test/test/CompilerTest.scala
index 1977d21e0..3ee5597e6 100644
--- a/test/test/CompilerTest.scala
+++ b/test/test/CompilerTest.scala
@@ -1,8 +1,10 @@
package test
+import dotty.tools.dotc.core.Contexts._
import dotty.partest.DPConfig
import dotty.tools.dotc.{Main, Bench, Driver}
-import dotty.tools.dotc.reporting.Reporter
+import dotty.tools.dotc.interfaces.Diagnostic.ERROR
+import dotty.tools.dotc.reporting._
import dotty.tools.dotc.util.SourcePosition
import dotty.tools.dotc.config.CompilerCommand
import dotty.tools.io.PlainFile
@@ -12,8 +14,6 @@ import scala.tools.partest.nest.{ FileManager, NestUI }
import scala.annotation.tailrec
import java.io.{ RandomAccessFile, File => JFile }
-import org.junit.Test
-
/** This class has two modes: it can directly run compiler tests, or it can
* generate the necessary file structure for partest in the directory
@@ -234,7 +234,22 @@ abstract class CompilerTest {
(implicit defaultOptions: List[String]): Unit = {
val allArgs = args ++ defaultOptions
val processor = if (allArgs.exists(_.startsWith("#"))) Bench else Main
- val reporter = processor.process(allArgs)
+ val storeReporter = new Reporter with UniqueMessagePositions with HideNonSensicalMessages {
+ private val consoleReporter = new ConsoleReporter()
+ private var innerStoreReporter = new StoreReporter(consoleReporter)
+ def doReport(d: Diagnostic)(implicit ctx: Context): Unit = {
+ if (innerStoreReporter == null) {
+ consoleReporter.report(d)
+ } else {
+ innerStoreReporter.report(d)
+ if (d.level == ERROR) {
+ innerStoreReporter.flush()
+ innerStoreReporter = null
+ }
+ }
+ }
+ }
+ val reporter = processor.process(allArgs, storeReporter)
val nerrors = reporter.errorCount
val xerrors = (expectedErrorsPerFile map {_.totalErrors}).sum
@@ -244,7 +259,7 @@ abstract class CompilerTest {
}
assert(nerrors == xerrors,
s"""Wrong # of errors. Expected: $xerrors, found: $nerrors
- |Files with expected errors: $expectedErrorFiles%, %
+ |Files with expected errors: $expectedErrorFiles
""".stripMargin)
// NEG TEST
if (xerrors > 0) {