summaryrefslogtreecommitdiff
path: root/integration
diff options
context:
space:
mode:
Diffstat (limited to 'integration')
-rw-r--r--integration/test/src/mill/integration/IntegrationTestSuite.scala35
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"))
}
}