aboutsummaryrefslogtreecommitdiff
path: root/test/test
diff options
context:
space:
mode:
Diffstat (limited to 'test/test')
-rw-r--r--test/test/CompilerTest.scala11
-rw-r--r--test/test/OtherEntryPointsTest.scala17
-rw-r--r--test/test/ShowClassTests.scala13
-rw-r--r--test/test/TestREPL.scala12
4 files changed, 41 insertions, 12 deletions
diff --git a/test/test/CompilerTest.scala b/test/test/CompilerTest.scala
index fe63106b5..5a4a9830a 100644
--- a/test/test/CompilerTest.scala
+++ b/test/test/CompilerTest.scala
@@ -133,15 +133,18 @@ abstract class CompilerTest {
}
}
- private def compileWithJavac(fs: Array[String], args: Array[String]): Unit = {
+ private def compileWithJavac(
+ fs: Array[String],
+ args: Array[String]
+ )(implicit defaultOptions: List[String]): Boolean = {
val scalaLib = findJarFromRuntime("scala-library")
val fullArgs = Array(
"javac",
"-classpath",
s".:$scalaLib"
- ) ++ args ++ fs ++ Array("-d", defaultOutputDir)
+ ) ++ args ++ defaultOptions.dropWhile("-d" != _).take(2) ++ fs
- Runtime.getRuntime.exec(fullArgs).waitFor()
+ Runtime.getRuntime.exec(fullArgs).waitFor() == 0
}
/** Compiles the code files in the given directory together. If args starts
@@ -169,7 +172,7 @@ abstract class CompilerTest {
log(s"WARNING: run tests can only be run by partest, JUnit just verifies compilation: $prefix$dirName")
val (filePaths, javaFilePaths, normArgs, expErrors) = computeFilePathsAndExpErrors
compileWithJavac(javaFilePaths, Array.empty) // javac needs to run first on dotty-library
- compileArgs(filePaths ++ normArgs, expErrors)
+ compileArgs(javaFilePaths ++ filePaths ++ normArgs, expErrors)
} else {
val (sourceDir, flags, deep) = args match {
case "-deep" :: args1 => (flattenDir(prefix, dirName), args1 ++ defaultOptions, "deep")
diff --git a/test/test/OtherEntryPointsTest.scala b/test/test/OtherEntryPointsTest.scala
index abaa043c0..ae46fa36f 100644
--- a/test/test/OtherEntryPointsTest.scala
+++ b/test/test/OtherEntryPointsTest.scala
@@ -17,10 +17,18 @@ import scala.collection.mutable.ListBuffer
* @see [[InterfaceEntryPointTest]]
*/
class OtherEntryPointsTest {
- @Test def runCompiler = {
- val sources = List("./tests/pos/HelloWorld.scala").map(p => new java.io.File(p).getPath())
- val args = sources ++ List("-d", "./out/")
+ private val sources =
+ List("./tests/pos/HelloWorld.scala").map(p => new java.io.File(p).getPath())
+ private val dottyInterfaces =
+ new java.io.File("./interfaces/dotty-interfaces-0.1-SNAPSHOT.jar").getPath
+ private val dottyLibrary =
+ new java.io.File("./library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar").getPath
+ private val args =
+ sources ++
+ List("-d", "./out/") ++
+ List("-classpath", dottyInterfaces + ":" + dottyLibrary)
+ @Test def runCompiler = {
val reporter = new CustomReporter
val callback = new CustomCompilerCallback
@@ -32,9 +40,6 @@ class OtherEntryPointsTest {
}
@Test def runCompilerWithContext = {
- val sources = List("./tests/pos/HelloWorld.scala").map(p => new java.io.File(p).getPath())
- val args = sources ++ List("-d", "./out/")
-
val reporter = new CustomReporter
val callback = new CustomCompilerCallback
val context = (new ContextBase).initialCtx.fresh
diff --git a/test/test/ShowClassTests.scala b/test/test/ShowClassTests.scala
index d5e59c169..81e304296 100644
--- a/test/test/ShowClassTests.scala
+++ b/test/test/ShowClassTests.scala
@@ -11,6 +11,19 @@ import dotty.tools.dotc.core.Decorators._
import org.junit.Test
class ShowClassTests extends DottyTest {
+ ctx = {
+ val base = new ContextBase
+ import base.settings._
+ val ctx = base.initialCtx.fresh
+ ctx.setSetting(ctx.settings.encoding, "UTF8")
+ ctx.setSetting(
+ ctx.settings.classpath,
+ "./library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar" +
+ ":./interfaces/target/dotty-interfaces-0.1-SNAPSHOT.jar"
+ )
+ base.initialize()(ctx)
+ ctx
+ }
def debug_println(msg: => Any) = {
if (sys.props.isDefinedAt("test.ShowClassTests.verbose"))
diff --git a/test/test/TestREPL.scala b/test/test/TestREPL.scala
index 9867cb4ec..cccfacc41 100644
--- a/test/test/TestREPL.scala
+++ b/test/test/TestREPL.scala
@@ -20,8 +20,16 @@ class TestREPL(script: String) extends REPL {
override lazy val config = new REPL.Config {
override val output = new NewLinePrintWriter(out)
- override def context(ctx: Context) =
- ctx.fresh.setSetting(ctx.settings.color, "never")
+ override def context(ctx: Context) = {
+ val fresh = ctx.fresh
+ fresh.setSetting(ctx.settings.color, "never")
+ fresh.setSetting(
+ ctx.settings.classpath,
+ "./library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar"
+ )
+ fresh.initialize()(fresh)
+ fresh
+ }
override def input(in: Interpreter)(implicit ctx: Context) = new InteractiveReader {
val lines = script.lines.buffered