aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Petrashko <dark@d-d.me>2016-07-15 11:52:54 +0200
committerGitHub <noreply@github.com>2016-07-15 11:52:54 +0200
commit1c02c56213cf22010c0aef1dc1446300fe8005fe (patch)
tree14dbce8fa1643dc626e088a5a0068be340bbe72f
parent71889a9011fbcb56ab6382bfb62e6dbac707721a (diff)
parent1b4511be11338f56feb79eb0fcd28fa6e642f775 (diff)
downloaddotty-1c02c56213cf22010c0aef1dc1446300fe8005fe.tar.gz
dotty-1c02c56213cf22010c0aef1dc1446300fe8005fe.tar.bz2
dotty-1c02c56213cf22010c0aef1dc1446300fe8005fe.zip
Merge pull request #1360 from dotty-staging/junit-discard-output
Discard reporter output for tests that succeed.
-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) {