summaryrefslogtreecommitdiff
path: root/core/src/test/scala
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test/scala')
-rw-r--r--core/src/test/scala/mill/discover/DiscoveredTests.scala14
-rw-r--r--core/src/test/scala/mill/util/TestGraphs.scala11
2 files changed, 24 insertions, 1 deletions
diff --git a/core/src/test/scala/mill/discover/DiscoveredTests.scala b/core/src/test/scala/mill/discover/DiscoveredTests.scala
index e606b2a9..98a54759 100644
--- a/core/src/test/scala/mill/discover/DiscoveredTests.scala
+++ b/core/src/test/scala/mill/discover/DiscoveredTests.scala
@@ -6,7 +6,7 @@ import mill.discover.Router.{ArgSig, EntryPoint}
import utest._
import mill.{Module, T}
import mill.discover.Mirror.Segment.Label
-import mill.util.TestGraphs.nestedModule
+import mill.util.TestGraphs.{TraitWithModuleObject, nestedModule}
object DiscoveredTests extends TestSuite{
val tests = Tests{
@@ -36,6 +36,18 @@ object DiscoveredTests extends TestSuite{
assert(mapped.toSet == expected.toSet)
}
+ 'traitWithModule - {
+ val discovered = Discovered[TraitWithModuleObject.type]
+ val mapped = discovered.targets(TraitWithModuleObject).map(x => x.segments -> x.target)
+ val expected = Seq(
+ (
+ List(Label("TraitModule"), Label("testFramework")),
+ TraitWithModuleObject.TraitModule.testFramework
+ )
+ )
+ assert(mapped == expected)
+ }
+
'commands - {
object outer {
def hello() = T.command{
diff --git a/core/src/test/scala/mill/util/TestGraphs.scala b/core/src/test/scala/mill/util/TestGraphs.scala
index edea69a4..a69221da 100644
--- a/core/src/test/scala/mill/util/TestGraphs.scala
+++ b/core/src/test/scala/mill/util/TestGraphs.scala
@@ -167,6 +167,17 @@ object TestGraphs{
}
+ trait TraitWithModule extends Module{ outer =>
+ object TraitModule extends Module{
+ def testFramework = T{ "mill.UTestFramework" }
+ def test() = T.command{ ()/*donothing*/ }
+ }
+ }
+
+
+ // Make sure nested objects inherited from traits work
+ object TraitWithModuleObject extends TraitWithModule
+
object singleCross{
val cross =