summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-02-04 11:44:29 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-02-04 13:29:30 -0800
commitf47697c1da18407374cf11372af36c4960d80576 (patch)
tree14dd0fe05a01eacd9b1ee8f655e7173410446aed /core
parent2536dc8c071c7c0fc41a0bd806d91ecad300f27c (diff)
downloadmill-f47697c1da18407374cf11372af36c4960d80576.tar.gz
mill-f47697c1da18407374cf11372af36c4960d80576.tar.bz2
mill-f47697c1da18407374cf11372af36c4960d80576.zip
Fix tests
Diffstat (limited to 'core')
-rw-r--r--core/src/mill/main/RunScript.scala2
-rw-r--r--core/test/src/mill/main/ParseArgsTest.scala42
2 files changed, 27 insertions, 17 deletions
diff --git a/core/src/mill/main/RunScript.scala b/core/src/mill/main/RunScript.scala
index 2efe0e97..4d74833e 100644
--- a/core/src/mill/main/RunScript.scala
+++ b/core/src/mill/main/RunScript.scala
@@ -142,8 +142,6 @@ object RunScript{
val moduleCls =
evaluator.rootModule.getClass.getClassLoader.loadClass(scoping.render + "$")
- pprint.log(moduleCls.getFields)
- pprint.log(moduleCls.getMethods)
val rootModule = moduleCls.getField("MODULE$").get(moduleCls).asInstanceOf[ExternalModule]
(rootModule, rootModule.millDiscover)
}
diff --git a/core/test/src/mill/main/ParseArgsTest.scala b/core/test/src/mill/main/ParseArgsTest.scala
index 2ef07d36..6678f12c 100644
--- a/core/test/src/mill/main/ParseArgsTest.scala
+++ b/core/test/src/mill/main/ParseArgsTest.scala
@@ -144,10 +144,14 @@ object ParseArgsTest extends TestSuite {
'apply - {
def check(input: Seq[String],
- expectedSelectors: List[List[Segment]],
+ expectedSelectors: List[(Option[List[Segment]], List[Segment])],
expectedArgs: Seq[String]) = {
- val Right((selectors, args)) = ParseArgs(input)
+ val Right((selectors0, args)) = ParseArgs(input)
+ val selectors = selectors0.map{
+ case (Some(v1), v2) => (Some(v1.value), v2.value)
+ case (None, v2) => (None, v2.value)
+ }
assert(
selectors == expectedSelectors,
args == expectedArgs
@@ -160,53 +164,60 @@ object ParseArgsTest extends TestSuite {
'singleSelector - check(
input = Seq("core.compile"),
expectedSelectors = List(
- List(Label("core"), Label("compile"))
+ None -> List(Label("core"), Label("compile"))
+ ),
+ expectedArgs = Seq.empty
+ )
+ 'externalSelector - check(
+ input = Seq("foo.bar/core.compile"),
+ expectedSelectors = List(
+ Some(List(Label("foo"), Label("bar"))) -> List(Label("core"), Label("compile"))
),
expectedArgs = Seq.empty
)
'singleSelectorWithArgs - check(
input = Seq("application.run", "hello", "world"),
expectedSelectors = List(
- List(Label("application"), Label("run"))
+ None -> List(Label("application"), Label("run"))
),
expectedArgs = Seq("hello", "world")
)
'singleSelectorWithCross - check(
input = Seq("bridges[2.12.4,jvm].compile"),
expectedSelectors = List(
- List(Label("bridges"), Cross(Seq("2.12.4", "jvm")), Label("compile"))
+ None -> List(Label("bridges"), Cross(Seq("2.12.4", "jvm")), Label("compile"))
),
expectedArgs = Seq.empty
)
'multiSelectorsBraceExpansion - check(
input = Seq("--all", "{core,application}.compile"),
expectedSelectors = List(
- List(Label("core"), Label("compile")),
- List(Label("application"), Label("compile"))
+ None -> List(Label("core"), Label("compile")),
+ None -> List(Label("application"), Label("compile"))
),
expectedArgs = Seq.empty
)
'multiSelectorsBraceExpansionWithArgs - check(
input = Seq("--all", "{core,application}.run", "--", "hello", "world"),
expectedSelectors = List(
- List(Label("core"), Label("run")),
- List(Label("application"), Label("run"))
+ None -> List(Label("core"), Label("run")),
+ None -> List(Label("application"), Label("run"))
),
expectedArgs = Seq("hello", "world")
)
'multiSelectorsBraceExpansionWithCross - check(
input = Seq("--all", "bridges[2.12.4,jvm].{test,jar}"),
expectedSelectors = List(
- List(Label("bridges"), Cross(Seq("2.12.4", "jvm")), Label("test")),
- List(Label("bridges"), Cross(Seq("2.12.4", "jvm")), Label("jar"))
+ None -> List(Label("bridges"), Cross(Seq("2.12.4", "jvm")), Label("test")),
+ None -> List(Label("bridges"), Cross(Seq("2.12.4", "jvm")), Label("jar"))
),
expectedArgs = Seq.empty
)
'multiSelectorsBraceExpansionInsideCross - check(
input = Seq("--all", "bridges[{2.11.11,2.11.8}].jar"),
expectedSelectors = List(
- List(Label("bridges"), Cross(Seq("2.11.11")), Label("jar")),
- List(Label("bridges"), Cross(Seq("2.11.8")), Label("jar"))
+ None -> List(Label("bridges"), Cross(Seq("2.11.11")), Label("jar")),
+ None -> List(Label("bridges"), Cross(Seq("2.11.8")), Label("jar"))
),
expectedArgs = Seq.empty
)
@@ -216,10 +227,11 @@ object ParseArgsTest extends TestSuite {
"Please use --all flag to run multiple tasks")
)
}
- 'multiSelectorsWithoutAllAsSingle - check( // this is how it works when we pass multiple tasks without --all flag
+ 'multiSelectorsWithoutAllAsSingle - check(
+ // this is how it works when we pass multiple tasks without --all flag
input = Seq("core.compile", "application.compile"),
expectedSelectors = List(
- List(Label("core"), Label("compile"))
+ None -> List(Label("core"), Label("compile"))
),
expectedArgs = Seq("application.compile")
)