aboutsummaryrefslogtreecommitdiff
path: root/test/test/CompilerTest.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-04-29 17:14:27 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-05-08 21:51:47 +0200
commitba2913bdb52bf1a42bd831e9429e044ee8d3c42f (patch)
tree45a9b14579632c2b1b254be08b9feac83f492945 /test/test/CompilerTest.scala
parent90aa3ba1df70fea42b4a1cafe6551e7c3204f012 (diff)
downloaddotty-ba2913bdb52bf1a42bd831e9429e044ee8d3c42f.tar.gz
dotty-ba2913bdb52bf1a42bd831e9429e044ee8d3c42f.tar.bz2
dotty-ba2913bdb52bf1a42bd831e9429e044ee8d3c42f.zip
Changes to test framework and tests
defaultOptions is now an implicit parameter, which means it can be overridden on a call-by-call basis. Added -Ycheck:front to verify that typed trees typecheck again with same types. The option is disabled for one of the structural tests.
Diffstat (limited to 'test/test/CompilerTest.scala')
-rw-r--r--test/test/CompilerTest.scala16
1 files changed, 7 insertions, 9 deletions
diff --git a/test/test/CompilerTest.scala b/test/test/CompilerTest.scala
index d52e74de7..1bf138d54 100644
--- a/test/test/CompilerTest.scala
+++ b/test/test/CompilerTest.scala
@@ -8,29 +8,27 @@ import dotty.tools.dotc.reporting.Reporter
class CompilerTest extends DottyTest {
- def defaultOptions: List[String] = Nil
-
- def compileArgs(args: Array[String], xerrors: Int = 0): Unit = {
+ def compileArgs(args: Array[String], xerrors: Int = 0)(implicit defaultOptions: List[String]): Unit = {
val allArgs = args ++ defaultOptions
val processor = if (allArgs.exists(_.startsWith("#"))) Bench else Main
val nerrors = processor.process(allArgs, ctx).count(Reporter.ERROR.level)
assert(nerrors == xerrors, s"Wrong # of errors. Expected: $xerrors, found: $nerrors")
}
- def compileLine(cmdLine: String, xerrors: Int = 0): Unit = compileArgs(cmdLine.split("\n"), xerrors)
+ def compileLine(cmdLine: String, xerrors: Int = 0)(implicit defaultOptions: List[String]): Unit = compileArgs(cmdLine.split("\n"), xerrors)
- def compileFile(prefix: String, fileName: String, args: List[String] = Nil, xerrors: Int = 0): Unit =
+ def compileFile(prefix: String, fileName: String, args: List[String] = Nil, xerrors: Int = 0)(implicit defaultOptions: List[String]): Unit =
compileArgs((s"$prefix$fileName.scala" :: args).toArray, xerrors)
- def compileDir(path: String, args: List[String] = Nil, xerrors: Int = 0): Unit =
+ def compileDir(path: String, args: List[String] = Nil, xerrors: Int = 0)(implicit defaultOptions: List[String]): Unit =
compileDir(Directory(path), args, xerrors)
- def compileDir(dir: Directory, args: List[String], xerrors: Int): Unit = {
+ def compileDir(dir: Directory, args: List[String], xerrors: Int)(implicit defaultOptions: List[String]): Unit = {
val fileNames = dir.files.toArray.map(_.toString).filter(_ endsWith ".scala")
compileArgs(fileNames ++ args, xerrors)
}
- def compileFiles(path: String, args: List[String] = Nil): Unit = {
+ def compileFiles(path: String, args: List[String] = Nil)(implicit defaultOptions: List[String]): Unit = {
val dir = Directory(path)
val fileNames = dir.files.toArray.map(_.toString).filter(_ endsWith ".scala")
for (name <- fileNames) {
@@ -43,7 +41,7 @@ class CompilerTest extends DottyTest {
}
}
}
-object CompilerText extends App {
+object CompilerTest extends App {
// val dotcDir = "/Users/odersky/workspace/dotty/src/dotty/"