From e1ec7ede675143492510b2d90260a430125e0808 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 9 Mar 2014 19:06:01 +0100 Subject: Improve test infrastructure 1) New method compileFiles which allows one to compile the content of a directory one file or directory after another. 2) max constraint is printed to typr. Added new test pos_all. Other pos tests can be retired. --- test/test/CompilerTest.scala | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'test/test/CompilerTest.scala') diff --git a/test/test/CompilerTest.scala b/test/test/CompilerTest.scala index 26a0b3831..d25cfb637 100644 --- a/test/test/CompilerTest.scala +++ b/test/test/CompilerTest.scala @@ -22,12 +22,26 @@ class CompilerTest extends DottyTest { def compileFile(prefix: String, fileName: String, args: List[String] = Nil, xerrors: Int = 0): Unit = compileArgs((s"$prefix$fileName.scala" :: args).toArray, xerrors) - def compileDir(path: String, args: List[String] = Nil, xerrors: Int = 0): Unit = { - val dir = Directory(path) + def compileDir(path: String, args: List[String] = Nil, xerrors: Int = 0): Unit = + compileDir(Directory(path), args, xerrors) + + def compileDir(dir: Directory, args: List[String], xerrors: Int): Unit = { val fileNames = dir.files.toArray.map(_.toString).filter(_ endsWith ".scala") compileArgs(fileNames ++ args, xerrors) } + def compileFiles(path: String, args: List[String] = Nil): Unit = { + val dir = Directory(path) + val fileNames = dir.files.toArray.map(_.toString).filter(_ endsWith ".scala") + for (name <- fileNames) { + println(s"testing $name") + compileArgs((name :: args).toArray, 0) + } + for (subdir <- dir.dirs) { + println(s"testing $subdir") + compileDir(subdir, args, 0) + } + } } object CompilerText extends App { -- cgit v1.2.3