summaryrefslogtreecommitdiff
path: root/main/test/src/define
diff options
context:
space:
mode:
Diffstat (limited to 'main/test/src/define')
-rw-r--r--main/test/src/define/ApplicativeTests.scala38
-rw-r--r--main/test/src/define/BasePathTests.scala20
-rw-r--r--main/test/src/define/CacherTests.scala12
-rw-r--r--main/test/src/define/DiscoverTests.scala16
-rw-r--r--main/test/src/define/GraphTests.scala46
-rw-r--r--main/test/src/define/MacroErrorTests.scala24
6 files changed, 78 insertions, 78 deletions
diff --git a/main/test/src/define/ApplicativeTests.scala b/main/test/src/define/ApplicativeTests.scala
index 9dd2132f..0f30a404 100644
--- a/main/test/src/define/ApplicativeTests.scala
+++ b/main/test/src/define/ApplicativeTests.scala
@@ -33,34 +33,34 @@ object ApplicativeTests extends TestSuite {
val tests = Tests{
- 'selfContained - {
+ test("selfContained"){
- 'simple - assert(Opt("lol " + 1) == Some("lol 1"))
- 'singleSome - assert(Opt("lol " + Some("hello")()) == Some("lol hello"))
- 'twoSomes - assert(Opt(Some("lol ")() + Some("hello")()) == Some("lol hello"))
- 'singleNone - assert(Opt("lol " + None()) == None)
- 'twoNones - assert(Opt("lol " + None() + None()) == None)
+ test("simple") - assert(Opt("lol " + 1) == Some("lol 1"))
+ test("singleSome") - assert(Opt("lol " + Some("hello")()) == Some("lol hello"))
+ test("twoSomes") - assert(Opt(Some("lol ")() + Some("hello")()) == Some("lol hello"))
+ test("singleNone") - assert(Opt("lol " + None()) == None)
+ test("twoNones") - assert(Opt("lol " + None() + None()) == None)
}
- 'context - {
+ test("context"){
assert(Opt(Opt.ctx() + Some("World")()) == Some("hellooooWorld"))
}
- 'capturing - {
+ test("capturing"){
val lol = "lol "
def hell(o: String) = "hell" + o
- 'simple - assert(Opt(lol + 1) == Some("lol 1"))
- 'singleSome - assert(Opt(lol + Some(hell("o"))()) == Some("lol hello"))
- 'twoSomes - assert(Opt(Some(lol)() + Some(hell("o"))()) == Some("lol hello"))
- 'singleNone - assert(Opt(lol + None()) == None)
- 'twoNones - assert(Opt(lol + None() + None()) == None)
+ test("simple") - assert(Opt(lol + 1) == Some("lol 1"))
+ test("singleSome") - assert(Opt(lol + Some(hell("o"))()) == Some("lol hello"))
+ test("twoSomes") - assert(Opt(Some(lol)() + Some(hell("o"))()) == Some("lol hello"))
+ test("singleNone") - assert(Opt(lol + None()) == None)
+ test("twoNones") - assert(Opt(lol + None() + None()) == None)
}
- 'allowedLocalDef - {
+ test("allowedLocalDef"){
// Although x is defined inside the Opt{...} block, it is also defined
// within the LHS of the Applyable#apply call, so it is safe to life it
// out into the `zipMap` arguments list.
val res = Opt{ "lol " + Some("hello").flatMap(x => Some(x)).apply() }
assert(res == Some("lol hello"))
}
- 'upstreamAlwaysEvaluated - {
+ test("upstreamAlwaysEvaluated"){
// Whether or not control-flow reaches the Applyable#apply call inside an
// Opt{...} block, we always evaluate the LHS of the Applyable#apply
// because it gets lifted out of any control flow statements
@@ -72,7 +72,7 @@ object ApplicativeTests extends TestSuite {
counter.value == 1
)
}
- 'upstreamEvaluatedOnlyOnce - {
+ test("upstreamEvaluatedOnlyOnce"){
// Even if control-flow reaches the Applyable#apply call more than once,
// it only gets evaluated once due to its lifting out of the Opt{...} block
val counter = new Counter()
@@ -84,7 +84,7 @@ object ApplicativeTests extends TestSuite {
counter.value == 1
)
}
- 'evaluationsInsideLambdasWork - {
+ test("evaluationsInsideLambdasWork"){
// This required some fiddling with owner chains inside the macro to get
// working, so ensure it doesn't regress
val counter = new Counter()
@@ -96,7 +96,7 @@ object ApplicativeTests extends TestSuite {
down2 == Some(Seq("hello2", "hello2hello2", "hello2hello2hello2"))
)
}
- 'appliesEvaluatedOncePerLexicalCallsite - {
+ test("appliesEvaluatedOncePerLexicalCallsite"){
// If you have multiple Applyable#apply() lexically in the source code of
// your Opt{...} call, each one gets evaluated once, even if the LHS of each
// apply() call is identical. It's up to the downstream zipMap()
@@ -106,7 +106,7 @@ object ApplicativeTests extends TestSuite {
val down = Opt{ Seq(1, 2, 3).map(n => n + up() + up()) }
assert(down == Some(Seq("1hello1hello2", "2hello1hello2", "3hello1hello2")))
}
- 'appliesEvaluateBeforehand - {
+ test("appliesEvaluateBeforehand"){
// Every Applyable#apply() within a Opt{...} block evaluates before any
// other logic within that block, even if they would happen first in the
// normal Scala evaluation order
diff --git a/main/test/src/define/BasePathTests.scala b/main/test/src/define/BasePathTests.scala
index b8a653c8..e77c8d98 100644
--- a/main/test/src/define/BasePathTests.scala
+++ b/main/test/src/define/BasePathTests.scala
@@ -10,48 +10,48 @@ object BasePathTests extends TestSuite{
val remaining = f(m).millSourcePath.relativeTo(m.millSourcePath).segments
assert(remaining == segments)
}
- 'singleton - {
+ test("singleton"){
check(testGraphs.singleton)(identity)
}
- 'backtickIdentifiers - {
+ test("backtickIdentifiers"){
check(testGraphs.bactickIdentifiers)(
_.`nested-module`,
"nested-module"
)
}
- 'separateGroups - {
+ test("separateGroups"){
check(TestGraphs.triangleTask)(identity)
}
- 'TraitWithModuleObject - {
+ test("TraitWithModuleObject"){
check(TestGraphs.TraitWithModuleObject)(
_.TraitModule,
"TraitModule"
)
}
- 'nestedModuleNested - {
+ test("nestedModuleNested"){
check(TestGraphs.nestedModule)(_.nested, "nested")
}
- 'nestedModuleInstance - {
+ test("nestedModuleInstance"){
check(TestGraphs.nestedModule)(_.classInstance, "classInstance")
}
- 'singleCross - {
+ test("singleCross"){
check(TestGraphs.singleCross)(_.cross, "cross")
check(TestGraphs.singleCross)(_.cross("210"), "cross", "210")
check(TestGraphs.singleCross)(_.cross("211"), "cross", "211")
}
- 'doubleCross - {
+ test("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 - {
+ test("nestedCrosses"){
check(TestGraphs.nestedCrosses)(_.cross, "cross")
check(TestGraphs.nestedCrosses)(
_.cross("210").cross2("js"),
"cross", "210", "cross2", "js"
)
}
- 'overriden - {
+ test("overriden"){
object overridenBasePath extends TestUtil.BaseModule {
override def millSourcePath = os.pwd / 'overridenBasePathRootValue
object nested extends Module{
diff --git a/main/test/src/define/CacherTests.scala b/main/test/src/define/CacherTests.scala
index 1524e5c1..882a8164 100644
--- a/main/test/src/define/CacherTests.scala
+++ b/main/test/src/define/CacherTests.scala
@@ -32,35 +32,35 @@ object CacherTests extends TestSuite{
}
def check(x: Any, y: Any) = assert(x == y)
- 'simpleDefIsCached - {
+ test("simpleDefIsCached"){
Predef.assert(Base.value eq Base.value)
Predef.assert(eval(Base, Base.value) == 1)
}
- 'resultDefIsCached - {
+ test("resultDefIsCached"){
Predef.assert(Base.result eq Base.result)
Predef.assert(eval(Base, Base.result) == 1)
}
- 'overridingDefIsAlsoCached - {
+ test("overridingDefIsAlsoCached"){
Predef.assert(eval(Middle, Middle.value) == 3)
Predef.assert(Middle.value eq Middle.value)
}
- 'overridenDefRemainsAvailable - {
+ test("overridenDefRemainsAvailable"){
Predef.assert(eval(Middle, Middle.overriden) == 1)
}
- 'multipleOverridesWork- {
+ test("multipleOverridesWork"){
Predef.assert(eval(Terminal, Terminal.value) == 7)
Predef.assert(eval(Terminal, Terminal.overriden) == 1)
}
// Doesn't fail, presumably compileError doesn't go far enough in the
// compilation pipeline to hit the override checks
//
- // 'overrideOutsideModuleFails - {
+ // test("overrideOutsideModuleFails"){
// compileError("""
// trait Foo{
// def x = 1
diff --git a/main/test/src/define/DiscoverTests.scala b/main/test/src/define/DiscoverTests.scala
index 248d6afe..b0c923fd 100644
--- a/main/test/src/define/DiscoverTests.scala
+++ b/main/test/src/define/DiscoverTests.scala
@@ -11,29 +11,29 @@ object DiscoverTests extends TestSuite{
val expected = targets.map(_(m)).toSet
assert(discovered == expected)
}
- 'singleton - {
+ test("singleton"){
check(testGraphs.singleton)(_.single)
}
- 'backtickIdentifiers {
+ test("backtickIdentifiers"){
check(testGraphs.bactickIdentifiers)(_.`up-target`, _.`a-down-target`, _.`nested-module`.`nested-target`)
}
- 'separateGroups - {
+ test("separateGroups"){
check(TestGraphs.triangleTask)(_.left, _.right)
}
- 'TraitWithModuleObject - {
+ test("TraitWithModuleObject"){
check(TestGraphs.TraitWithModuleObject)(_.TraitModule.testFrameworks)
}
- 'nestedModule - {
+ test("nestedModule"){
check(TestGraphs.nestedModule)(_.single, _.nested.single, _.classInstance.single)
}
- 'singleCross - {
+ test("singleCross"){
check(TestGraphs.singleCross)(
_.cross("210").suffix,
_.cross("211").suffix,
_.cross("212").suffix
)
}
- 'doubleCross - {
+ test("doubleCross"){
check(TestGraphs.doubleCross)(
_.cross("210", "jvm").suffix,
_.cross("210", "js").suffix,
@@ -44,7 +44,7 @@ object DiscoverTests extends TestSuite{
_.cross("212", "native").suffix
)
}
- 'nestedCrosses - {
+ test("nestedCrosses"){
check(TestGraphs.nestedCrosses)(
_.cross("210").cross2("jvm").suffix,
_.cross("210").cross2("js").suffix,
diff --git a/main/test/src/define/GraphTests.scala b/main/test/src/define/GraphTests.scala
index b36dbf95..17c9dcf2 100644
--- a/main/test/src/define/GraphTests.scala
+++ b/main/test/src/define/GraphTests.scala
@@ -14,34 +14,34 @@ object GraphTests extends TestSuite{
import graphs._
import TestGraphs._
- 'topoSortedTransitiveTargets - {
+ test("topoSortedTransitiveTargets"){
def check(targets: Agg[Task[_]], expected: Agg[Task[_]]) = {
val result = Graph.topoSorted(Graph.transitiveTargets(targets)).values
TestUtil.checkTopological(result)
assert(result == expected)
}
- 'singleton - check(
+ test("singleton") - check(
targets = Agg(singleton.single),
expected = Agg(singleton.single)
)
- 'backtickIdentifiers - check(
+ test("backtickIdentifiers") - check(
targets = Agg(bactickIdentifiers.`a-down-target`),
expected = Agg(bactickIdentifiers.`up-target`, bactickIdentifiers.`a-down-target`)
)
- 'pair - check(
+ test("pair") - check(
targets = Agg(pair.down),
expected = Agg(pair.up, pair.down)
)
- 'anonTriple - check(
+ test("anonTriple") - check(
targets = Agg(anonTriple.down),
expected = Agg(anonTriple.up, anonTriple.down.inputs(0), anonTriple.down)
)
- 'diamond - check(
+ test("diamond") - check(
targets = Agg(diamond.down),
expected = Agg(diamond.up, diamond.left, diamond.right, diamond.down)
)
- 'anonDiamond - check(
+ test("anonDiamond") - check(
targets = Agg(diamond.down),
expected = Agg(
diamond.up,
@@ -50,7 +50,7 @@ object GraphTests extends TestSuite{
diamond.down
)
)
- 'defCachedDiamond - check(
+ test("defCachedDiamond") - check(
targets = Agg(defCachedDiamond.down),
expected = Agg(
defCachedDiamond.up.inputs(0),
@@ -63,14 +63,14 @@ object GraphTests extends TestSuite{
defCachedDiamond.down
)
)
- 'bigSingleTerminal - {
+ test("bigSingleTerminal"){
val result = Graph.topoSorted(Graph.transitiveTargets(Agg(bigSingleTerminal.j))).values
TestUtil.checkTopological(result)
assert(result.size == 28)
}
}
- 'groupAroundNamedTargets - {
+ test("groupAroundNamedTargets"){
def check[T, R <: Target[Int]](base: T)
(target: T => R,
important0: Agg[T => Target[_]],
@@ -94,12 +94,12 @@ object GraphTests extends TestSuite{
}
}
- 'singleton - check(singleton)(
+ test("singleton") - check(singleton)(
_.single,
Agg(_.single),
Agg(singleton.single -> 1)
)
- 'backtickIdentifiers - check(bactickIdentifiers)(
+ test("backtickIdentifiers") - check(bactickIdentifiers)(
_.`a-down-target`,
Agg(_.`up-target`, _.`a-down-target`),
Agg(
@@ -107,17 +107,17 @@ object GraphTests extends TestSuite{
bactickIdentifiers.`a-down-target` -> 1
)
)
- 'pair - check(pair)(
+ test("pair") - check(pair)(
_.down,
Agg(_.up, _.down),
Agg(pair.up -> 1, pair.down -> 1)
)
- 'anonTriple - check(anonTriple)(
+ test("anonTriple") - check(anonTriple)(
_.down,
Agg(_.up, _.down),
Agg(anonTriple.up -> 1, anonTriple.down -> 2)
)
- 'diamond - check(diamond)(
+ test("diamond") - check(diamond)(
_.down,
Agg(_.up, _.left, _.right, _.down),
Agg(
@@ -128,7 +128,7 @@ object GraphTests extends TestSuite{
)
)
- 'defCachedDiamond - check(defCachedDiamond)(
+ test("defCachedDiamond") - check(defCachedDiamond)(
_.down,
Agg(_.up, _.left, _.right, _.down),
Agg(
@@ -139,7 +139,7 @@ object GraphTests extends TestSuite{
)
)
- 'anonDiamond - check(anonDiamond)(
+ test("anonDiamond") - check(anonDiamond)(
_.down,
Agg(_.down, _.up),
Agg(
@@ -147,7 +147,7 @@ object GraphTests extends TestSuite{
anonDiamond.down -> 3
)
)
- 'bigSingleTerminal - check(bigSingleTerminal)(
+ test("bigSingleTerminal") - check(bigSingleTerminal)(
_.j,
Agg(_.a, _.b, _.e, _.f, _.i, _.j),
Agg(
@@ -160,7 +160,7 @@ object GraphTests extends TestSuite{
)
)
}
- 'multiTerminalGroupCounts - {
+ test("multiTerminalGroupCounts"){
def countGroups(goals: Task[_]*) = {
val topoSorted = Graph.topoSorted(
@@ -173,13 +173,13 @@ object GraphTests extends TestSuite{
grouped.keyCount
}
- 'separateGroups - {
+ test("separateGroups"){
import separateGroups._
val groupCount = countGroups(right, left)
assert(groupCount == 3)
}
- 'triangleTask - {
+ test("triangleTask"){
// Make sure the following graph ends up as a single group, since although
// `right` depends on `left`, both of them depend on the un-cached `task`
// which would force them both to re-compute every time `task` changes
@@ -189,7 +189,7 @@ object GraphTests extends TestSuite{
}
- 'multiTerminalGroup - {
+ test("multiTerminalGroup"){
// Make sure the following graph ends up as two groups
import multiTerminalGroup._
val groupCount = countGroups(right, left)
@@ -197,7 +197,7 @@ object GraphTests extends TestSuite{
}
- 'multiTerminalBoundary - {
+ test("multiTerminalBoundary"){
// Make sure the following graph ends up as a three groups: one for
// each cached target, and one for the downstream task we are running
import multiTerminalBoundary._
diff --git a/main/test/src/define/MacroErrorTests.scala b/main/test/src/define/MacroErrorTests.scala
index c8b140fa..a52f4ad6 100644
--- a/main/test/src/define/MacroErrorTests.scala
+++ b/main/test/src/define/MacroErrorTests.scala
@@ -7,7 +7,7 @@ object MacroErrorTests extends TestSuite{
val tests = Tests{
- 'errors{
+ test("errors"){
val expectedMsg =
"T{} members must be defs defined in a Cacher class/trait/object body"
@@ -15,8 +15,8 @@ object MacroErrorTests extends TestSuite{
assert(err.msg == expectedMsg)
}
- 'badParameterSets - {
- 'command - {
+ test("badParameterSets"){
+ test("command"){
val e = compileError("""
object foo extends mill.util.TestUtil.BaseModule{
def w = T.command{1}
@@ -28,7 +28,7 @@ object MacroErrorTests extends TestSuite{
e.pos.contains("def w = ")
)
}
- 'target - {
+ test("target"){
val e = compileError("""
object foo extends mill.util.TestUtil.BaseModule{
def x() = T{1}
@@ -40,7 +40,7 @@ object MacroErrorTests extends TestSuite{
e.pos.contains("def x() = ")
)
}
- 'input - {
+ test("input"){
val e = compileError("""
object foo extends mill.util.TestUtil.BaseModule{
def y() = T.input{1}
@@ -52,7 +52,7 @@ object MacroErrorTests extends TestSuite{
e.pos.contains("def y() = ")
)
}
- 'sources - {
+ test("sources"){
val e = compileError("""
object foo extends mill.util.TestUtil.BaseModule{
def z() = T.sources{ammonite.ops.pwd}
@@ -64,7 +64,7 @@ object MacroErrorTests extends TestSuite{
e.pos.contains("def z() = ")
)
}
- 'persistent - {
+ test("persistent"){
val e = compileError("""
object foo extends mill.util.TestUtil.BaseModule{
def a() = T.persistent{1}
@@ -77,11 +77,11 @@ object MacroErrorTests extends TestSuite{
)
}
}
- 'badTmacro - {
+ test("badTmacro"){
// Make sure we can reference values from outside the T{...} block as part
// of our `Target#apply()` calls, but we cannot reference any values that
// come from inside the T{...} block
- 'pos - {
+ test("pos"){
val e = compileError("""
val a = T{ 1 }
val arr = Array(a)
@@ -96,7 +96,7 @@ object MacroErrorTests extends TestSuite{
"Modules, Targets and Commands can only be defined within a mill Module")
)
}
- 'neg - {
+ test("neg"){
val expectedMsg =
"Target#apply() call cannot use `value n` defined within the T{...} block"
@@ -112,7 +112,7 @@ object MacroErrorTests extends TestSuite{
}""")
assert(err.msg == expectedMsg)
}
- 'neg2 - {
+ test("neg2"){
val expectedMsg =
"Target#apply() call cannot use `value x` defined within the T{...} block"
@@ -127,7 +127,7 @@ object MacroErrorTests extends TestSuite{
}""")
assert(err.msg == expectedMsg)
}
- 'neg3{
+ test("neg3"){
val borkedCachedDiamond1 = utest.compileError("""
object borkedCachedDiamond1 {
def up = T{ TestUtil.test() }