aboutsummaryrefslogtreecommitdiff
path: root/compiler/test/dotty/tools/dotc/CompilationTests.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2017-03-13 10:42:24 +0100
committerFelix Mulder <felix.mulder@gmail.com>2017-03-29 10:33:22 +0200
commit3acba311aaf831c1b249341142e1308ed1f73050 (patch)
tree89593e10907e9375de3c2d380c721a6e6e6c76c7 /compiler/test/dotty/tools/dotc/CompilationTests.scala
parent57f8d1b1f7962f99cf27501994b1440e369fe597 (diff)
downloaddotty-3acba311aaf831c1b249341142e1308ed1f73050.tar.gz
dotty-3acba311aaf831c1b249341142e1308ed1f73050.tar.bz2
dotty-3acba311aaf831c1b249341142e1308ed1f73050.zip
Add support for error annotations in neg tests
Diffstat (limited to 'compiler/test/dotty/tools/dotc/CompilationTests.scala')
-rw-r--r--compiler/test/dotty/tools/dotc/CompilationTests.scala61
1 files changed, 61 insertions, 0 deletions
diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala
new file mode 100644
index 000000000..22f7e6d91
--- /dev/null
+++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala
@@ -0,0 +1,61 @@
+package dotty
+package tools
+package dotc
+
+import org.junit.Test
+import java.io.{ File => JFile }
+
+class CompilationTests extends ParallelTesting {
+ import CompilationTests.{ defaultOutputDir, defaultOptions }
+
+ @Test def compilePos =
+ compileFilesInDir("../tests/pos", defaultOptions).pos
+
+ @Test def compileNeg =
+ compileShallowFilesInDir("../tests/neg", defaultOptions).neg
+}
+
+object CompilationTests {
+ implicit val defaultOutputDir: String = "../out/"
+
+ private val noCheckOptions = Array(
+ "-pagewidth", "80"
+ )
+
+ private val checkOptions = Array(
+ "-Yno-deep-subtypes",
+ "-Yno-double-bindings",
+ "-Yforce-sbt-phases"
+ )
+
+ private val classPath = {
+ val paths = Jars.dottyTestDeps map { p =>
+ val file = new JFile(p)
+ assert(
+ file.exists,
+ s"""|File "$p" couldn't be found. Run `packageAll` from build tool before
+ |testing.
+ |
+ |If running without sbt, test paths need to be setup environment variables:
+ |
+ | - DOTTY_LIBRARY
+ | - DOTTY_COMPILER
+ | - DOTTY_INTERFACES
+ | - DOTTY_EXTRAS
+ |
+ |Where these all contain locations, except extras which is a colon
+ |separated list of jars.
+ |
+ |When compiling with eclipse, you need the sbt-interfaces jar, put
+ |it in extras."""
+ )
+ file.getAbsolutePath
+ } mkString (":")
+
+ Array("-classpath", paths)
+ }
+
+ private val yCheckOptions = Array("-Ycheck:tailrec,resolveSuper,mixin,restoreScopes,labelDef")
+
+ val defaultOptions = noCheckOptions ++ checkOptions ++ yCheckOptions ++ classPath
+}