diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-01-28 22:43:40 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-01-28 22:43:40 -0800 |
commit | bc777b3c4e83149f45df7edda245868e22495eb3 (patch) | |
tree | b2e58f641bc9db34d17193b495cf07e76a9e13a5 /integration/test | |
parent | 42d24a0b59fa21bfa79040c2cd51a1f7384eee12 (diff) | |
download | mill-bc777b3c4e83149f45df7edda245868e22495eb3.tar.gz mill-bc777b3c4e83149f45df7edda245868e22495eb3.tar.bz2 mill-bc777b3c4e83149f45df7edda245868e22495eb3.zip |
Extract out `ScriptTestSuite` from `IntegrationTestSuite` and use it to create a version of `JavaCompilerJarTests` that runs through our main method & script runner.
This should let us catch a lot of bugs with `MainRunner` and friends quickly, without needing to run the slow integration tests
Diffstat (limited to 'integration/test')
-rw-r--r-- | integration/test/src/mill/integration/IntegrationTestSuite.scala | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/integration/test/src/mill/integration/IntegrationTestSuite.scala b/integration/test/src/mill/integration/IntegrationTestSuite.scala index 043e4afa..4edecbe5 100644 --- a/integration/test/src/mill/integration/IntegrationTestSuite.scala +++ b/integration/test/src/mill/integration/IntegrationTestSuite.scala @@ -1,38 +1,25 @@ package mill.integration -import java.io.{ByteArrayInputStream, ByteArrayOutputStream, InputStream, PrintStream} - import ammonite.ops._ -import mill.define.Segments -import mill.main.ParseArgs +import mill.util.ScriptTestSuite import utest._ -abstract class IntegrationTestSuite(repoKey: String, workspaceSlug: String) extends TestSuite{ - val workspacePath = pwd / 'target / 'workspace / workspaceSlug +abstract class IntegrationTestSuite(repoKey: String, val workspaceSlug: String) + extends ScriptTestSuite{ val buildFilePath = pwd / 'integration / 'test / 'resources / workspaceSlug - val stdOutErr = new PrintStream(new ByteArrayOutputStream()) -// val stdOutErr = new PrintStream(System.out) - val stdIn = new ByteArrayInputStream(Array()) - val runner = new mill.main.MainRunner( - ammonite.main.Cli.Config(wd = workspacePath), false, - stdOutErr, stdOutErr, stdIn - ) - def eval(s: String*) = runner.runScript(workspacePath / "build.sc", s.toList) - def meta(s: String) = { - val (List(selector), args) = ParseArgs.apply(Seq(s)).right.get - - read(workspacePath / "out" / selector.flatMap(_.pathSegments) / "meta.json") - } - def initWorkspace() = { - rm(workspacePath) - mkdir(workspacePath / up) + def scriptSourcePath = { // The unzipped git repo snapshots we get from github come with a // wrapper-folder inside the zip file, so copy the wrapper folder to the // destination instead of the folder containing the wrapper. + val path = sys.props(repoKey) val Seq(wrapper) = ls(Path(path)) - cp(wrapper, workspacePath) - cp(buildFilePath / "build.sc", workspacePath / "build.sc") + wrapper + } + + override def initWorkspace() = { + super.initWorkspace() + cp.over(buildFilePath / "build.sc", workspacePath / "build.sc") assert(!ls.rec(workspacePath).exists(_.ext == "class")) } } |