1
1
package test
2
2
3
+ import dotty .tools .dotc .core .Contexts ._
3
4
import dotty .partest .DPConfig
4
5
import dotty .tools .dotc .{Main , Bench , Driver }
5
- import dotty .tools .dotc .reporting .Reporter
6
+ import dotty .tools .dotc .interfaces .Diagnostic .ERROR
7
+ import dotty .tools .dotc .reporting ._
6
8
import dotty .tools .dotc .util .SourcePosition
7
9
import dotty .tools .dotc .config .CompilerCommand
8
10
import dotty .tools .io .PlainFile
@@ -12,8 +14,6 @@ import scala.tools.partest.nest.{ FileManager, NestUI }
12
14
import scala .annotation .tailrec
13
15
import java .io .{ RandomAccessFile , File => JFile }
14
16
15
- import org .junit .Test
16
-
17
17
18
18
/** This class has two modes: it can directly run compiler tests, or it can
19
19
* generate the necessary file structure for partest in the directory
@@ -234,7 +234,22 @@ abstract class CompilerTest {
234
234
(implicit defaultOptions : List [String ]): Unit = {
235
235
val allArgs = args ++ defaultOptions
236
236
val processor = if (allArgs.exists(_.startsWith(" #" ))) Bench else Main
237
- val reporter = processor.process(allArgs)
237
+ val storeReporter = new Reporter with UniqueMessagePositions with HideNonSensicalMessages {
238
+ private val consoleReporter = new ConsoleReporter ()
239
+ private var innerStoreReporter = new StoreReporter (consoleReporter)
240
+ def doReport (d : Diagnostic )(implicit ctx : Context ): Unit = {
241
+ if (innerStoreReporter == null ) {
242
+ consoleReporter.report(d)
243
+ } else {
244
+ innerStoreReporter.report(d)
245
+ if (d.level == ERROR ) {
246
+ innerStoreReporter.flush()
247
+ innerStoreReporter = null
248
+ }
249
+ }
250
+ }
251
+ }
252
+ val reporter = processor.process(allArgs, storeReporter)
238
253
239
254
val nerrors = reporter.errorCount
240
255
val xerrors = (expectedErrorsPerFile map {_.totalErrors}).sum
@@ -244,7 +259,7 @@ abstract class CompilerTest {
244
259
}
245
260
assert(nerrors == xerrors,
246
261
s """ Wrong # of errors. Expected: $xerrors, found: $nerrors
247
- |Files with expected errors: $expectedErrorFiles%, %
262
+ |Files with expected errors: $expectedErrorFiles
248
263
""" .stripMargin)
249
264
// NEG TEST
250
265
if (xerrors > 0 ) {
0 commit comments