diff options
Diffstat (limited to 'main/test')
-rw-r--r-- | main/test/src/mill/main/JavaCompileJarTests.scala | 2 | ||||
-rw-r--r-- | main/test/src/mill/util/ScriptTestSuite.scala | 18 | ||||
-rw-r--r-- | main/test/src/mill/util/TestEvaluator.scala | 4 |
3 files changed, 16 insertions, 8 deletions
diff --git a/main/test/src/mill/main/JavaCompileJarTests.scala b/main/test/src/mill/main/JavaCompileJarTests.scala index fb047675..635ac3c5 100644 --- a/main/test/src/mill/main/JavaCompileJarTests.scala +++ b/main/test/src/mill/main/JavaCompileJarTests.scala @@ -4,7 +4,7 @@ import ammonite.ops._ import mill.util.ScriptTestSuite import utest._ -object JavaCompileJarTests extends ScriptTestSuite { +object JavaCompileJarTests extends ScriptTestSuite(fork = false) { def workspaceSlug = "java-compile-jar" def scriptSourcePath = pwd / 'main / 'test / 'resources / 'examples / 'javac val tests = Tests{ diff --git a/main/test/src/mill/util/ScriptTestSuite.scala b/main/test/src/mill/util/ScriptTestSuite.scala index 0d1ff43a..8958b464 100644 --- a/main/test/src/mill/util/ScriptTestSuite.scala +++ b/main/test/src/mill/util/ScriptTestSuite.scala @@ -5,19 +5,27 @@ import java.io.{ByteArrayInputStream, ByteArrayOutputStream, PrintStream} import ammonite.ops._ import utest._ -abstract class ScriptTestSuite extends TestSuite{ +abstract class ScriptTestSuite(fork: Boolean) extends TestSuite{ def workspaceSlug: String def scriptSourcePath: Path val workspacePath = pwd / 'target / 'workspace / workspaceSlug -// val stdOutErr = new PrintStream(new ByteArrayOutputStream()) - val stdOutErr = new PrintStream(System.out) + val stdOutErr = new PrintStream(new ByteArrayOutputStream()) +// val stdOutErr = new PrintStream(System.out) val stdIn = new ByteArrayInputStream(Array()) - val runner = new mill.main.MainRunner( + lazy val runner = new mill.main.MainRunner( ammonite.main.Cli.Config(wd = workspacePath), stdOutErr, stdOutErr, stdIn ) - def eval(s: String*) = runner.runScript(workspacePath / "build.sc", s.toList) + def eval(s: String*) = { + if (!fork) runner.runScript(workspacePath / "build.sc", s.toList) + else{ + try { + %%(home / "mill-release", s)(workspacePath) + true + }catch{case e: Throwable => false} + } + } def meta(s: String) = { val (List(selector), args) = ParseArgs.apply(Seq(s), multiSelect = false).right.get diff --git a/main/test/src/mill/util/TestEvaluator.scala b/main/test/src/mill/util/TestEvaluator.scala index 285aa659..a5be0488 100644 --- a/main/test/src/mill/util/TestEvaluator.scala +++ b/main/test/src/mill/util/TestEvaluator.scala @@ -28,8 +28,8 @@ class TestEvaluator[T <: TestUtil.BaseModule](module: T) tp: TestPath){ val outPath = TestUtil.getOutPath() -// val logger = DummyLogger - val logger = new PrintLogger(true, ammonite.util.Colors.Default, System.out, System.out, System.err) + val logger = DummyLogger +// val logger = new PrintLogger(true, ammonite.util.Colors.Default, System.out, System.out, System.err) val evaluator = new Evaluator(outPath, TestEvaluator.externalOutPath, module, discover, logger) def apply[T](t: Task[T]): Either[Result.Failing[T], (T, Int)] = { |