From 101d124acda3cc8edf7ea3c55db8b80fb1e1cd05 Mon Sep 17 00:00:00 2001 From: Felix Mulder Date: Thu, 16 Mar 2017 16:37:43 +0100 Subject: Move REPL diff tests out of `tests.scala` --- compiler/test/dotc/tests.scala | 2 -- compiler/test/dotty/tools/dotc/CompilerTest.scala | 17 ---------------- compiler/test/dotty/tools/dotc/repl/TestREPL.scala | 23 ++++++++++++++++++++++ 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/compiler/test/dotc/tests.scala b/compiler/test/dotc/tests.scala index 3ebf7f2c4..ce8dff056 100644 --- a/compiler/test/dotc/tests.scala +++ b/compiler/test/dotc/tests.scala @@ -85,7 +85,6 @@ class tests extends CompilerTest { val negDir = testsDir + "neg/" val runDir = testsDir + "run/" val newDir = testsDir + "new/" - val replDir = testsDir + "repl/" val javaDir = testsDir + "pos-java-interop/" val sourceDir = "./src/" @@ -173,7 +172,6 @@ class tests extends CompilerTest { @Test def pos_utf16 = compileFile(posSpecialDir, "utf16encoded", explicitUTF16) @Test def new_all = compileFiles(newDir, twice) - @Test def repl_all = replFiles(replDir) @Test def neg_all = compileFiles(negDir, verbose = true, compileSubDirs = false) @Test def neg_typedIdents() = compileDir(negDir, "typedIdents") diff --git a/compiler/test/dotty/tools/dotc/CompilerTest.scala b/compiler/test/dotty/tools/dotc/CompilerTest.scala index db12994f4..f35f9f919 100644 --- a/compiler/test/dotty/tools/dotc/CompilerTest.scala +++ b/compiler/test/dotty/tools/dotc/CompilerTest.scala @@ -237,23 +237,6 @@ 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 ============= private def expectedErrors(filePaths: List[String]): List[ErrorsInFile] = if (filePaths.exists(isNegTest(_))) filePaths.map(getErrors(_)) else Nil diff --git a/compiler/test/dotty/tools/dotc/repl/TestREPL.scala b/compiler/test/dotty/tools/dotc/repl/TestREPL.scala index a38abcbab..131a88ab1 100644 --- a/compiler/test/dotty/tools/dotc/repl/TestREPL.scala +++ b/compiler/test/dotty/tools/dotc/repl/TestREPL.scala @@ -5,6 +5,8 @@ package repl import core.Contexts.Context import collection.mutable import java.io.StringWriter +import dotty.tools.io.{ PlainFile, Directory } +import org.junit.Test /** A subclass of REPL used for testing. * It takes a transcript of a REPL session in `script`. The transcript @@ -62,3 +64,24 @@ class TestREPL(script: String) extends REPL { } } } + +class REPLTests { + 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) { + println(s"testing $path$name") + replFile(path, name) + } + } + + @Test def replAll = replFiles("../tests/repl/") +} -- cgit v1.2.3