summaryrefslogtreecommitdiff
path: root/core/test
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-02-02 23:36:35 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-02-02 23:36:35 -0800
commit4c76e9668ab9683dad1966bcd6fb5031a81f8460 (patch)
tree333a31b9f5dc247f94ea7011b108502a0fb1bdf1 /core/test
parent932bc5c53bb380930e04765ae51c5a128f3b35fb (diff)
downloadmill-4c76e9668ab9683dad1966bcd6fb5031a81f8460.tar.gz
mill-4c76e9668ab9683dad1966bcd6fb5031a81f8460.tar.bz2
mill-4c76e9668ab9683dad1966bcd6fb5031a81f8460.zip
- Renamed `Ctx.FooCtx` => `Ctx.Foo`
- Remove un-used `Evaluator#millSourcePath` parameter
Diffstat (limited to 'core/test')
-rw-r--r--core/test/src/mill/define/CacherTests.scala2
-rw-r--r--core/test/src/mill/eval/CrossTests.scala12
-rw-r--r--core/test/src/mill/eval/EvaluationTests.scala2
-rw-r--r--core/test/src/mill/eval/FailureTests.scala10
-rw-r--r--core/test/src/mill/eval/JavaCompileJarTests.scala8
-rw-r--r--core/test/src/mill/eval/ModuleTests.scala3
-rw-r--r--core/test/src/mill/eval/TaskTests.scala9
-rw-r--r--core/test/src/mill/util/TestEvaluator.scala6
8 files changed, 21 insertions, 31 deletions
diff --git a/core/test/src/mill/define/CacherTests.scala b/core/test/src/mill/define/CacherTests.scala
index 7619e770..a14f2f34 100644
--- a/core/test/src/mill/define/CacherTests.scala
+++ b/core/test/src/mill/define/CacherTests.scala
@@ -29,7 +29,7 @@ object CacherTests extends TestSuite{
def eval[T <: TestUtil.TestBuild, V](mapping: T, v: Task[V])
(implicit discover: Discover[T], tp: TestPath) = {
val workspace = ammonite.ops.pwd / 'target / 'workspace / tp.value
- val evaluator = new TestEvaluator(mapping, workspace, pwd)
+ val evaluator = new TestEvaluator(mapping, workspace)
evaluator(v).right.get._1
}
diff --git a/core/test/src/mill/eval/CrossTests.scala b/core/test/src/mill/eval/CrossTests.scala
index 6c369cc0..af13474b 100644
--- a/core/test/src/mill/eval/CrossTests.scala
+++ b/core/test/src/mill/eval/CrossTests.scala
@@ -13,8 +13,7 @@ object CrossTests extends TestSuite{
'singleCross - {
val check = new TestEvaluator(
singleCross,
- pwd / 'target / 'workspace / "cross-tests" / "inputs",
- pwd
+ pwd / 'target / 'workspace / "cross-tests" / "inputs"
)
val Right(("210", 1)) = check.apply(singleCross.cross("210").suffix)
@@ -25,8 +24,7 @@ object CrossTests extends TestSuite{
'crossResolved - {
val check = new TestEvaluator(
crossResolved,
- pwd / 'target / 'workspace / "cross-tests" / "crossResolved",
- pwd
+ pwd / 'target / 'workspace / "cross-tests" / "crossResolved"
)
val Right(("2.10", 1)) = check.apply(crossResolved.foo("2.10").suffix)
@@ -42,8 +40,7 @@ object CrossTests extends TestSuite{
'doubleCross - {
val check = new TestEvaluator(
doubleCross,
- pwd / 'target / 'workspace / "cross-tests" / "doubleCross",
- pwd
+ pwd / 'target / 'workspace / "cross-tests" / "doubleCross"
)
val Right(("210_jvm", 1)) = check.apply(doubleCross.cross("210", "jvm").suffix)
@@ -58,8 +55,7 @@ object CrossTests extends TestSuite{
'nestedCrosses - {
val check = new TestEvaluator(
nestedCrosses,
- pwd / 'target / 'workspace / "cross-tests" / "nestedCrosses",
- pwd
+ pwd / 'target / 'workspace / "cross-tests" / "nestedCrosses"
)
val Right(("210_jvm", 1)) = check.apply(nestedCrosses.cross("210").cross2("jvm").suffix)
diff --git a/core/test/src/mill/eval/EvaluationTests.scala b/core/test/src/mill/eval/EvaluationTests.scala
index 386d5340..9fabe623 100644
--- a/core/test/src/mill/eval/EvaluationTests.scala
+++ b/core/test/src/mill/eval/EvaluationTests.scala
@@ -17,7 +17,7 @@ object EvaluationTests extends TestSuite{
rm(Path(workspace, pwd))
// Make sure data is persisted even if we re-create the evaluator each time
- def evaluator = new TestEvaluator(module, workspace, pwd).evaluator
+ def evaluator = new TestEvaluator(module, workspace).evaluator
def apply(target: Task[_], expValue: Any,
expEvaled: Agg[Task[_]],
diff --git a/core/test/src/mill/eval/FailureTests.scala b/core/test/src/mill/eval/FailureTests.scala
index d4758a12..e7c231ee 100644
--- a/core/test/src/mill/eval/FailureTests.scala
+++ b/core/test/src/mill/eval/FailureTests.scala
@@ -1,7 +1,7 @@
package mill.eval
import mill.T
import mill.util.{TestEvaluator, TestUtil}
-import ammonite.ops.pwd
+import ammonite.ops.{Path, pwd, rm}
import utest._
import utest.framework.TestPath
import mill.util.TestEvaluator.implicitDisover
@@ -18,7 +18,7 @@ object FailureTests extends TestSuite{
'evaluateSingle - {
ammonite.ops.rm(ammonite.ops.Path(workspace, ammonite.ops.pwd))
- val check = new TestEvaluator(singleton, workspace, pwd)
+ val check = new TestEvaluator(singleton, workspace)
check.fail(
target = singleton.single,
expectedFailCount = 0,
@@ -53,8 +53,8 @@ object FailureTests extends TestSuite{
)
}
'evaluatePair - {
- val check = new TestEvaluator(pair, workspace, pwd)
- ammonite.ops.rm(ammonite.ops.Path(workspace, ammonite.ops.pwd))
+ val check = new TestEvaluator(pair, workspace)
+ rm(Path(workspace, pwd))
check.fail(
pair.down,
expectedFailCount = 0,
@@ -95,7 +95,7 @@ object FailureTests extends TestSuite{
def right = T{ task() + left() + T.ctx().dest.toString().length }
}
- val check = new TestEvaluator(build, workspace, pwd)
+ val check = new TestEvaluator(build, workspace)
val Right(_) = check(build.left)
val Left(Result.Exception(e, _)) = check(build.right)
assert(e.getMessage.contains("`dest` can only be used in one place"))
diff --git a/core/test/src/mill/eval/JavaCompileJarTests.scala b/core/test/src/mill/eval/JavaCompileJarTests.scala
index 0137f372..ba80cc3c 100644
--- a/core/test/src/mill/eval/JavaCompileJarTests.scala
+++ b/core/test/src/mill/eval/JavaCompileJarTests.scala
@@ -4,7 +4,7 @@ import ammonite.ops.ImplicitWd._
import ammonite.ops._
import mill.define.{Discover, Input, Target, Task}
import mill.modules.Jvm
-import mill.util.Ctx.DestCtx
+import mill.util.Ctx.Dest
import mill.{Module, T}
import mill.util.{DummyLogger, Loose, TestEvaluator, TestUtil}
import mill.util.Strict.Agg
@@ -12,7 +12,7 @@ import utest._
import mill._
import TestEvaluator.implicitDisover
object JavaCompileJarTests extends TestSuite{
- def compileAll(sources: Seq[PathRef])(implicit ctx: DestCtx) = {
+ def compileAll(sources: Seq[PathRef])(implicit ctx: Dest) = {
mkdir(ctx.dest)
import ammonite.ops._
%("javac", sources.map(_.path.toString()), "-d", ctx.dest)(wd = ctx.dest)
@@ -50,11 +50,11 @@ object JavaCompileJarTests extends TestSuite{
import Build._
def eval[T](t: Task[T]) = {
- val evaluator = new TestEvaluator(Build, workspacePath, pwd)
+ val evaluator = new TestEvaluator(Build, workspacePath)
evaluator.apply(t)
}
def check(targets: Agg[Task[_]], expected: Agg[Task[_]]) = {
- val evaluator = new TestEvaluator(Build, workspacePath, pwd)
+ val evaluator = new TestEvaluator(Build, workspacePath)
evaluator.check(targets, expected)
}
diff --git a/core/test/src/mill/eval/ModuleTests.scala b/core/test/src/mill/eval/ModuleTests.scala
index db70fee3..c7e85169 100644
--- a/core/test/src/mill/eval/ModuleTests.scala
+++ b/core/test/src/mill/eval/ModuleTests.scala
@@ -22,8 +22,7 @@ object ModuleTests extends TestSuite{
'externalModuleTargetsAreNamespacedByModulePackagePath - {
val check = new TestEvaluator(
Build,
- pwd / 'target / 'external,
- pwd
+ pwd / 'target / 'external
)
val Right((30, 1)) = check.apply(Build.z)
diff --git a/core/test/src/mill/eval/TaskTests.scala b/core/test/src/mill/eval/TaskTests.scala
index 9d868006..af2e19a9 100644
--- a/core/test/src/mill/eval/TaskTests.scala
+++ b/core/test/src/mill/eval/TaskTests.scala
@@ -58,8 +58,7 @@ object TaskTests extends TestSuite{
// to re-evaluate, but normal Tasks behind a Target run once then are cached
val check = new TestEvaluator(
build,
- pwd / 'target / 'workspace / "task-tests" / "inputs",
- pwd
+ pwd / 'target / 'workspace / "task-tests" / "inputs"
)
val Right((1, 1)) = check.apply(build.taskInput)
@@ -75,8 +74,7 @@ object TaskTests extends TestSuite{
// Persistent tasks keep the working dir around between runs
val check = new TestEvaluator(
build,
- pwd / 'target / 'workspace / "task-tests" / "persistent",
- pwd
+ pwd / 'target / 'workspace / "task-tests" / "persistent"
)
val Right((1, 1)) = check.apply(build.persistent)
val Right((2, 1)) = check.apply(build.persistent)
@@ -91,8 +89,7 @@ object TaskTests extends TestSuite{
// Persistent task
def check = new TestEvaluator(
build,
- pwd / 'target / 'workspace / "task-tests" / "worker",
- pwd
+ pwd / 'target / 'workspace / "task-tests" / "worker"
)
val Right((2, 1)) = check.apply(build.noisyWorkerDownstream)
diff --git a/core/test/src/mill/util/TestEvaluator.scala b/core/test/src/mill/util/TestEvaluator.scala
index 416ed71c..dd113b55 100644
--- a/core/test/src/mill/util/TestEvaluator.scala
+++ b/core/test/src/mill/util/TestEvaluator.scala
@@ -12,13 +12,11 @@ object TestEvaluator{
implicit def implicitDisover[T]: Discover[T] = macro applyImpl[T]
val externalOutPath = pwd / 'target / 'external
}
-class TestEvaluator[T <: TestUtil.TestBuild](module: T,
- workspacePath: Path,
- millSourcePath: Path)
+class TestEvaluator[T <: TestUtil.TestBuild](module: T, workspacePath: Path)
(implicit discover: Discover[T]){
// val logger = DummyLogger
val logger = new PrintLogger(true, ammonite.util.Colors.Default, System.out, System.out, System.err)
- val evaluator = new Evaluator(workspacePath, millSourcePath, TestEvaluator.externalOutPath, module, discover, logger)
+ val evaluator = new Evaluator(workspacePath, TestEvaluator.externalOutPath, module, discover, logger)
def apply[T](t: Task[T]): Either[Result.Failing, (T, Int)] = {
val evaluated = evaluator.evaluate(Agg(t))