Skip to content

Commit ecc1da8

Browse files
committed
Move REPL diff tests out of tests.scala
1 parent 1811293 commit ecc1da8

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

compiler/test/dotc/tests.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ class tests extends CompilerTest {
8585
val negDir = testsDir + "neg/"
8686
val runDir = testsDir + "run/"
8787
val newDir = testsDir + "new/"
88-
val replDir = testsDir + "repl/"
8988
val javaDir = testsDir + "pos-java-interop/"
9089

9190
val sourceDir = "./src/"
@@ -172,7 +171,6 @@ class tests extends CompilerTest {
172171
@Test def pos_utf16 = compileFile(posSpecialDir, "utf16encoded", explicitUTF16)
173172

174173
@Test def new_all = compileFiles(newDir, twice)
175-
@Test def repl_all = replFiles(replDir)
176174

177175
@Test def neg_all = compileFiles(negDir, verbose = true, compileSubDirs = false)
178176
@Test def neg_typedIdents() = compileDir(negDir, "typedIdents")

compiler/test/dotty/tools/dotc/CompilerTest.scala

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -237,23 +237,6 @@ abstract class CompilerTest {
237237
}
238238
}
239239

240-
def replFile(prefix: String, fileName: String): Unit = {
241-
val path = s"$prefix$fileName"
242-
val f = new PlainFile(path)
243-
val repl = new TestREPL(new String(f.toCharArray))
244-
repl.process(Array[String]())
245-
repl.check()
246-
}
247-
248-
def replFiles(path: String): Unit = {
249-
val dir = Directory(path)
250-
val fileNames = dir.files.toArray.map(_.jfile.getName).filter(_ endsWith ".check")
251-
for (name <- fileNames) {
252-
log(s"testing $path$name")
253-
replFile(path, name)
254-
}
255-
}
256-
257240
// ========== HELPERS =============
258241

259242
private def expectedErrors(filePaths: List[String]): List[ErrorsInFile] = if (filePaths.exists(isNegTest(_))) filePaths.map(getErrors(_)) else Nil

compiler/test/dotty/tools/dotc/repl/TestREPL.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ package repl
55
import core.Contexts.Context
66
import collection.mutable
77
import java.io.StringWriter
8+
import dotty.tools.io.{ PlainFile, Directory }
9+
import org.junit.Test
810

911
/** A subclass of REPL used for testing.
1012
* It takes a transcript of a REPL session in `script`. The transcript
@@ -62,3 +64,24 @@ class TestREPL(script: String) extends REPL {
6264
}
6365
}
6466
}
67+
68+
class REPLTests {
69+
def replFile(prefix: String, fileName: String): Unit = {
70+
val path = s"$prefix$fileName"
71+
val f = new PlainFile(path)
72+
val repl = new TestREPL(new String(f.toCharArray))
73+
repl.process(Array[String]())
74+
repl.check()
75+
}
76+
77+
def replFiles(path: String): Unit = {
78+
val dir = Directory(path)
79+
val fileNames = dir.files.toArray.map(_.jfile.getName).filter(_ endsWith ".check")
80+
for (name <- fileNames) {
81+
println(s"testing $path$name")
82+
replFile(path, name)
83+
}
84+
}
85+
86+
@Test def replAll = replFiles("../tests/repl/")
87+
}

0 commit comments

Comments
 (0)