diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-12-29 22:47:15 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-12-29 22:47:15 -0800 |
commit | 3ce3d6214b1c52c692926ab373412b71fe097c21 (patch) | |
tree | b8aee0d02ea98833ff5062c564632911cd464911 /core/src/test/scala | |
parent | 81d4cfb6f63512b314fbbf49c4ba415aedc469d7 (diff) | |
download | mill-3ce3d6214b1c52c692926ab373412b71fe097c21.tar.gz mill-3ce3d6214b1c52c692926ab373412b71fe097c21.tar.bz2 mill-3ce3d6214b1c52c692926ab373412b71fe097c21.zip |
Assign different overrides of a Target different cache directories and paths, to fix https://github.com/lihaoyi/mill/issues/86
Diffstat (limited to 'core/src/test/scala')
4 files changed, 22 insertions, 3 deletions
diff --git a/core/src/test/scala/mill/discover/DiscoveredTests.scala b/core/src/test/scala/mill/discover/DiscoveredTests.scala index b2d14080..8501f4cc 100644 --- a/core/src/test/scala/mill/discover/DiscoveredTests.scala +++ b/core/src/test/scala/mill/discover/DiscoveredTests.scala @@ -68,11 +68,12 @@ object DiscoveredTests extends TestSuite{ val outerCommands = discovered.mirror.commands assertMatch(outerCommands){case Seq( - EntryPoint("hello", Nil, None, false, _), + EntryPoint("hello", Nil, None, false, _, _), EntryPoint("echoPair", List(ArgSig("prefix", "String", None, None), ArgSig("suffix", "String", None, None)), None, false, + _, _ ) ) =>} @@ -82,7 +83,7 @@ object DiscoveredTests extends TestSuite{ .flatMap(_._2.commands.asInstanceOf[Seq[EntryPoint[_]]]) assertMatch(innerCommands){case Seq( - EntryPoint("inner", _, None, false, _), + EntryPoint("inner", _, None, false, _, _), ) =>} } diff --git a/core/src/test/scala/mill/eval/EvaluationTests.scala b/core/src/test/scala/mill/eval/EvaluationTests.scala index 2b40724a..75a6cc52 100644 --- a/core/src/test/scala/mill/eval/EvaluationTests.scala +++ b/core/src/test/scala/mill/eval/EvaluationTests.scala @@ -196,6 +196,13 @@ object EvaluationTests extends TestSuite{ checker(task2, 4, OSet(), extraEvaled = -1, secondRunNoOp = false) } + 'overrideSuperTask - { + import canOverrideSuper._ + + val checker = new Checker(mapping(canOverrideSuper)) + checker(foo, Seq("base", "object"), OSet(foo), extraEvaled = -1) + } + 'tasksAreUncached - { // Make sure the tasks `left` and `middle` re-compute every time, while // the target `right` does not diff --git a/core/src/test/scala/mill/util/TestGraphs.scala b/core/src/test/scala/mill/util/TestGraphs.scala index 46ca9ff9..0f2c769f 100644 --- a/core/src/test/scala/mill/util/TestGraphs.scala +++ b/core/src/test/scala/mill/util/TestGraphs.scala @@ -167,6 +167,14 @@ object TestGraphs{ } + trait BaseModule extends Module { + def foo = T{ Seq("base") } + } + + object canOverrideSuper extends BaseModule { + override def foo = T{ super.foo() ++ Seq("object") } + } + trait TraitWithModule extends Module{ outer => object TraitModule extends Module{ def testFramework = T{ "mill.UTestFramework" } diff --git a/core/src/test/scala/mill/util/TestUtil.scala b/core/src/test/scala/mill/util/TestUtil.scala index 8adbc87a..0457431b 100644 --- a/core/src/test/scala/mill/util/TestUtil.scala +++ b/core/src/test/scala/mill/util/TestUtil.scala @@ -1,5 +1,6 @@ package mill.util +import ammonite.main.Router.Overrides import mill.define.{Caller, Target, Task} import mill.eval.Result import utest.assert @@ -38,8 +39,10 @@ object TestUtil { val pure: Boolean) (implicit enclosing0: sourcecode.Enclosing, owner0: Caller[mill.Module], - name0: sourcecode.Name) + name0: sourcecode.Name, + o: Overrides) extends Test(inputs) with Target[Int]{ + val overrides = o.value val enclosing = enclosing0.value val owner = owner0.value val name = name0.value |