From e1fb19412c5dcc722e7df24e543aadf03a463c9a Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 17 Mar 2016 16:19:03 +0100 Subject: Add REPL tests --- test/test/CompilerTest.scala | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'test/test/CompilerTest.scala') diff --git a/test/test/CompilerTest.scala b/test/test/CompilerTest.scala index ef2f719fc..1ca836133 100644 --- a/test/test/CompilerTest.scala +++ b/test/test/CompilerTest.scala @@ -5,12 +5,12 @@ import dotty.tools.dotc.{Main, Bench, Driver} import dotty.tools.dotc.reporting.Reporter import dotty.tools.dotc.util.SourcePosition import dotty.tools.dotc.config.CompilerCommand +import dotty.tools.io.PlainFile import scala.collection.mutable.ListBuffer import scala.reflect.io.{ Path, Directory, File => SFile, AbstractFile } import scala.tools.partest.nest.{ FileManager, NestUI } import scala.annotation.tailrec import java.io.{ RandomAccessFile, File => JFile } -import dotty.tools.io.PlainFile import org.junit.Test @@ -205,7 +205,22 @@ abstract class CompilerTest { } } + def replFile(prefix: String, fileName: String): Unit = { + val path = s"$prefix$fileName" + val f = new PlainFile(path) + val repl = new TestREPL(new String(f.toCharArray)) + repl.process(Array[String]()) + repl.check() + } + def replFiles(path: String): Unit = { + val dir = Directory(path) + val fileNames = dir.files.toArray.map(_.jfile.getName).filter(_ endsWith ".check") + for (name <- fileNames) { + log(s"testing $path$name") + replFile(path, name) + } + } // ========== HELPERS ============= -- cgit v1.2.3