diff options
Diffstat (limited to 'test/files/presentation/t8934/Runner.scala')
-rw-r--r-- | test/files/presentation/t8934/Runner.scala | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/files/presentation/t8934/Runner.scala b/test/files/presentation/t8934/Runner.scala new file mode 100644 index 0000000000..944f458391 --- /dev/null +++ b/test/files/presentation/t8934/Runner.scala @@ -0,0 +1,27 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest +import scala.reflect.internal.util.SourceFile +import scala.tools.nsc.interactive.Response + +object Test extends InteractiveTest { + + override def execute(): Unit = { + val src = loadSourceAndWaitUntilTypechecked("Source.scala") + checkErrors(src) + } + + private def loadSourceAndWaitUntilTypechecked(sourceName: String): SourceFile = { + val sourceFile = sourceFiles.find(_.file.name == sourceName).head + askReload(List(sourceFile)).get + askLoadedTyped(sourceFile).get + sourceFile + } + + private def checkErrors(source: SourceFile): Unit = compiler.getUnitOf(source) match { + case Some(unit) => + val problems = unit.problems.toList + if(problems.isEmpty) reporter.println("Test OK") + else problems.foreach(problem => reporter.println(problem.msg)) + + case None => reporter.println("No compilation unit found for " + source.file.name) + } +} |