1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
package mill.define
import mill.util.{TestGraphs, TestUtil}
import utest._
import ammonite.ops._
import mill.{Module, T}
object BasePathTests extends TestSuite{
val testGraphs = new TestGraphs
val tests = Tests{
def check(m: Module, segments: String*) = {
val remaining = m.millSourcePath.relativeTo(pwd).segments.drop(1)
assert(remaining == segments)
}
'singleton - {
check(testGraphs.singleton)
}
'separateGroups - {
check(TestGraphs.triangleTask)
}
'TraitWithModuleObject - {
check(TestGraphs.TraitWithModuleObject.TraitModule,
"TraitModule"
)
}
'nestedModuleNested - {
check(TestGraphs.nestedModule.nested, "nested")
}
'nestedModuleInstance - {
check(TestGraphs.nestedModule.classInstance, "classInstance")
}
'singleCross - {
check(TestGraphs.singleCross.cross, "cross")
check(TestGraphs.singleCross.cross("210"), "cross", "210")
check(TestGraphs.singleCross.cross("211"), "cross", "211")
}
'doubleCross - {
check(TestGraphs.doubleCross.cross, "cross")
check(TestGraphs.doubleCross.cross("210", "jvm"), "cross", "210", "jvm")
check(TestGraphs.doubleCross.cross("212", "js"), "cross", "212", "js")
}
'nestedCrosses - {
check(TestGraphs.nestedCrosses.cross, "cross")
check(
TestGraphs.nestedCrosses.cross("210").cross2("js"),
"cross", "210", "cross2", "js"
)
}
'overriden - {
object overridenBasePath extends TestUtil.BaseModule {
override def millSourcePath = pwd / 'overridenBasePathRootValue
object nested extends Module{
override def millSourcePath = super.millSourcePath / 'overridenBasePathNested
object nested extends Module{
override def millSourcePath = super.millSourcePath / 'overridenBasePathDoubleNested
}
}
}
assert(
overridenBasePath.millSourcePath == pwd / 'overridenBasePathRootValue,
overridenBasePath.nested.millSourcePath == pwd / 'overridenBasePathRootValue / 'nested / 'overridenBasePathNested,
overridenBasePath.nested.nested.millSourcePath == pwd / 'overridenBasePathRootValue / 'nested / 'overridenBasePathNested / 'nested / 'overridenBasePathDoubleNested
)
}
}
}
|