diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-04-01 22:57:43 -0700 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-04-06 13:33:31 -0700 |
commit | 36eb8bd6bfd534d002b01f8800e4b5d896aa4e77 (patch) | |
tree | 8c3d7ea982a6e5fba52e1d6dc7b02958e7e1c2f0 /main/test | |
parent | 7d80dd1f0847e38db54966ea7fbd08400840ba7d (diff) | |
download | mill-36eb8bd6bfd534d002b01f8800e4b5d896aa4e77.tar.gz mill-36eb8bd6bfd534d002b01f8800e4b5d896aa4e77.tar.bz2 mill-36eb8bd6bfd534d002b01f8800e4b5d896aa4e77.zip |
- Add `mill version` command
- Make `Evaluator` robust against `null` results
Diffstat (limited to 'main/test')
-rw-r--r-- | main/test/src/mill/eval/EvaluationTests.scala | 26 | ||||
-rw-r--r-- | main/test/src/mill/util/TestGraphs.scala | 17 |
2 files changed, 43 insertions, 0 deletions
diff --git a/main/test/src/mill/eval/EvaluationTests.scala b/main/test/src/mill/eval/EvaluationTests.scala index 66147963..9c215086 100644 --- a/main/test/src/mill/eval/EvaluationTests.scala +++ b/main/test/src/mill/eval/EvaluationTests.scala @@ -247,6 +247,32 @@ object EvaluationTests extends TestSuite{ !overriden.contains("object1") ) } + 'nullTasks - { + import nullTasks._ + val checker = new Checker(nullTasks) + checker(nullTarget1, null, Agg(nullTarget1), extraEvaled = -1) + checker(nullTarget1, null, Agg(), extraEvaled = -1) + checker(nullTarget2, null, Agg(nullTarget2), extraEvaled = -1) + checker(nullTarget2, null, Agg(), extraEvaled = -1) + checker(nullTarget3, null, Agg(nullTarget3), extraEvaled = -1) + checker(nullTarget3, null, Agg(), extraEvaled = -1) + checker(nullTarget4, null, Agg(nullTarget4), extraEvaled = -1) + checker(nullTarget4, null, Agg(), extraEvaled = -1) + + val nc1 = nullCommand1() + val nc2 = nullCommand2() + val nc3 = nullCommand3() + val nc4 = nullCommand4() + + checker(nc1, null, Agg(nc1), extraEvaled = -1, secondRunNoOp = false) + checker(nc1, null, Agg(nc1), extraEvaled = -1, secondRunNoOp = false) + checker(nc2, null, Agg(nc2), extraEvaled = -1, secondRunNoOp = false) + checker(nc2, null, Agg(nc2), extraEvaled = -1, secondRunNoOp = false) + checker(nc3, null, Agg(nc3), extraEvaled = -1, secondRunNoOp = false) + checker(nc3, null, Agg(nc3), extraEvaled = -1, secondRunNoOp = false) + checker(nc4, null, Agg(nc4), extraEvaled = -1, secondRunNoOp = false) + checker(nc4, null, Agg(nc4), extraEvaled = -1, secondRunNoOp = false) + } 'tasksAreUncached - { // Make sure the tasks `left` and `middle` re-compute every time, while diff --git a/main/test/src/mill/util/TestGraphs.scala b/main/test/src/mill/util/TestGraphs.scala index 11f72d02..83e03576 100644 --- a/main/test/src/mill/util/TestGraphs.scala +++ b/main/test/src/mill/util/TestGraphs.scala @@ -196,6 +196,23 @@ object TestGraphs{ override lazy val millDiscover: Discover[this.type] = Discover[this.type] } + object nullTasks extends TestUtil.BaseModule{ + val nullString: String = null + def nullTask1 = T.task{ nullString } + def nullTask2 = T.task{ nullTask1() } + + def nullTarget1 = T{ nullString } + def nullTarget2 = T{ nullTarget1() } + def nullTarget3 = T{ nullTask1() } + def nullTarget4 = T{ nullTask2() } + + def nullCommand1() = T.command{ nullString } + def nullCommand2() = T.command{ nullTarget1() } + def nullCommand3() = T.command{ nullTask1() } + def nullCommand4() = T.command{ nullTask2() } + + override lazy val millDiscover: Discover[this.type] = Discover[this.type] + } object singleCross extends TestUtil.BaseModule { object cross extends mill.Cross[Cross]("210", "211", "212") |