summaryrefslogtreecommitdiff
path: root/main/test
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-02-17 23:41:39 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-02-17 23:45:43 -0800
commit0013898d7628980f920dba7eed68153b36fd26fb (patch)
tree04306367d8e1a95817dcaf39ae4302d51b629432 /main/test
parent6c66864dd45cb1f12524f9645b2c9158e5e0b592 (diff)
downloadmill-0013898d7628980f920dba7eed68153b36fd26fb.tar.gz
mill-0013898d7628980f920dba7eed68153b36fd26fb.tar.bz2
mill-0013898d7628980f920dba7eed68153b36fd26fb.zip
Update resolution tests in `MainTests.scala`
Added test cases for new "Did you mean...", "Try `mill.resolve ...`" hints
Diffstat (limited to 'main/test')
-rw-r--r--main/test/src/mill/eval/EvaluationTests.scala4
-rw-r--r--main/test/src/mill/main/MainTests.scala63
2 files changed, 52 insertions, 15 deletions
diff --git a/main/test/src/mill/eval/EvaluationTests.scala b/main/test/src/mill/eval/EvaluationTests.scala
index e5f0e57d..da399449 100644
--- a/main/test/src/mill/eval/EvaluationTests.scala
+++ b/main/test/src/mill/eval/EvaluationTests.scala
@@ -211,7 +211,7 @@ object EvaluationTests extends TestSuite{
val public = ammonite.ops.read(checker.evaluator.outPath / 'foo / "meta.json")
val overriden = ammonite.ops.read(
checker.evaluator.outPath / 'foo /
- 'overriden / "mill.util.TestGraphs.BaseModule#foo" / "meta.json"
+ 'overriden / "mill" / "util" / "TestGraphs" / "BaseModule#foo" / "meta.json"
)
assert(
public.contains("base"),
@@ -239,7 +239,7 @@ object EvaluationTests extends TestSuite{
val public = ammonite.ops.read(checker.evaluator.outPath / 'cmd / "meta.json")
val overriden = ammonite.ops.read(
checker.evaluator.outPath / 'cmd /
- 'overriden / "mill.util.TestGraphs.BaseModule#cmd" / "meta.json"
+ 'overriden / "mill" / "util" / "TestGraphs" / "BaseModule#cmd" / "meta.json"
)
assert(
public.contains("base1"),
diff --git a/main/test/src/mill/main/MainTests.scala b/main/test/src/mill/main/MainTests.scala
index 7ad5c00e..fbf193e1 100644
--- a/main/test/src/mill/main/MainTests.scala
+++ b/main/test/src/mill/main/MainTests.scala
@@ -27,19 +27,39 @@ object MainTests extends TestSuite{
'single - {
val check = MainTests.check(singleton) _
'pos - check("single", Right(Seq(_.single)))
- 'neg1 - check("doesntExist", Left("Cannot resolve doesntExist. Try `mill resolve _` to see what's available."))
- 'neg2 - check("single.doesntExist", Left("Cannot resolve single. Try `mill resolve _` to see what's available."))
- 'neg3 - check("", Left("Selector cannot be empty"))
+ 'neg1 - check("sngle", Left("Cannot resolve sngle. Did you mean single?"))
+ 'neg2 - check("snigle", Left("Cannot resolve snigle. Did you mean single?"))
+ 'neg3 - check("nsiigle", Left("Cannot resolve nsiigle. Did you mean single?"))
+ 'neg4 - check("ansiigle", Left("Cannot resolve ansiigle. Try `mill resolve _` to see what's available."))
+ 'neg5 - check("doesntExist", Left("Cannot resolve doesntExist. Try `mill resolve _` to see what's available."))
+ 'neg6 - check("single.doesntExist", Left("Task single is not a module and has no children."))
+ 'neg7 - check("", Left("Selector cannot be empty"))
}
'nested - {
val check = MainTests.check(nestedModule) _
'pos1 - check("single", Right(Seq(_.single)))
'pos2 - check("nested.single", Right(Seq(_.nested.single)))
'pos3 - check("classInstance.single", Right(Seq(_.classInstance.single)))
- 'neg1 - check("doesntExist", Left("Cannot resolve doesntExist"))
- 'neg2 - check("single.doesntExist", Left("Cannot resolve single"))
- 'neg3 - check("nested.doesntExist", Left("Cannot resolve nested.doesntExist"))
- 'neg4 - check("classInstance.doesntExist", Left("Cannot resolve classInstance.doesntExist"))
+ 'neg1 - check(
+ "doesntExist",
+ Left("Cannot resolve doesntExist. Try `mill resolve _` to see what's available.")
+ )
+ 'neg2 - check(
+ "single.doesntExist",
+ Left("Task single is not a module and has no children.")
+ )
+ 'neg3 - check(
+ "nested.doesntExist",
+ Left("Cannot resolve nested.doesntExist. Try `mill resolve nested._` to see what's available.")
+ )
+ 'neg3 - check(
+ "nested.singel",
+ Left("Cannot resolve nested.singel. Did you mean nested.single?")
+ )
+ 'neg4 - check(
+ "classInstance.doesntExist",
+ Left("Cannot resolve classInstance.doesntExist. Try `mill resolve classInstance._` to see what's available.")
+ )
'wildcard - check(
"_.single",
Right(Seq(
@@ -49,11 +69,15 @@ object MainTests extends TestSuite{
)
'wildcardNeg - check(
"_._.single",
- Left("Cannot resolve _")
+ Left("Cannot resolve _._.single. Try `mill resolve _` to see what's available")
)
'wildcardNeg2 - check(
"_._.__",
- Left("Cannot resolve _")
+ Left("Cannot resolve _._.__. Try `mill resolve _` to see what's available")
+ )
+ 'wildcardNeg3 - check(
+ "nested._.foobar",
+ Left("Cannot resolve nested._.foobar. Try `mill resolve nested._` to see what's available")
)
'wildcard2 - check(
"__.single",
@@ -78,9 +102,22 @@ object MainTests extends TestSuite{
val check = MainTests.check(singleCross) _
'pos1 - check("cross[210].suffix", Right(Seq(_.cross("210").suffix)))
'pos2 - check("cross[211].suffix", Right(Seq(_.cross("211").suffix)))
- 'neg1 - check("cross[210].doesntExist", Left("Cannot resolve cross[210].doesntExist"))
- 'neg2 - check("cross[doesntExist].doesntExist", Left("Cannot resolve cross[doesntExist]"))
- 'neg2 - check("cross[doesntExist].suffix", Left("Cannot resolve cross[doesntExist]"))
+ 'neg1 - check(
+ "cross[210].doesntExist",
+ Left("Cannot resolve cross[210].doesntExist. Try `mill resolve cross[210]._` to see what's available.")
+ )
+ 'neg2 - check(
+ "cross[doesntExist].doesntExist",
+ Left("Cannot resolve cross[doesntExist]. Try `mill resolve cross[__]` to see what's available.")
+ )
+ 'neg3 - check(
+ "cross[221].doesntExist",
+ Left("Cannot resolve cross[221]. Did you mean cross[211]?")
+ )
+ 'neg4 - check(
+ "cross[doesntExist].suffix",
+ Left("Cannot resolve cross[doesntExist]. Try `mill resolve cross[__]` to see what's available.")
+ )
'wildcard - check(
"cross[_].suffix",
Right(Seq(
@@ -111,7 +148,7 @@ object MainTests extends TestSuite{
'wildcard - {
'labelNeg - check(
"_.suffix",
- Left("Cannot resolve _.suffix")
+ Left("Cannot resolve _.suffix. Try `mill resolve _._` to see what's available.")
)
'labelPos - check(
"__.suffix",