diff options
author | Tobias Roeser <le.petit.fou@web.de> | 2018-12-20 21:14:26 +0100 |
---|---|---|
committer | Tobias Roeser <le.petit.fou@web.de> | 2018-12-21 20:19:29 +0100 |
commit | 5eb4dca58f8551d3cf67dd876ef3e0e46ca18126 (patch) | |
tree | 3fbb44d3259aaaeed977d1e2c31f4b245da32f4b /main/test/src | |
parent | 0cea8f67adc515e58b511283905caa3bce5e632a (diff) | |
download | mill-5eb4dca58f8551d3cf67dd876ef3e0e46ca18126.tar.gz mill-5eb4dca58f8551d3cf67dd876ef3e0e46ca18126.tar.bz2 mill-5eb4dca58f8551d3cf67dd876ef3e0e46ca18126.zip |
Also added failFast test cases
Diffstat (limited to 'main/test/src')
-rw-r--r-- | main/test/src/eval/FailureTests.scala | 69 | ||||
-rw-r--r-- | main/test/src/util/TestEvaluator.scala | 4 |
2 files changed, 71 insertions, 2 deletions
diff --git a/main/test/src/eval/FailureTests.scala b/main/test/src/eval/FailureTests.scala index dcfbcb60..d1b3c750 100644 --- a/main/test/src/eval/FailureTests.scala +++ b/main/test/src/eval/FailureTests.scala @@ -79,6 +79,40 @@ object FailureTests extends TestSuite{ expectedRawValues = Seq(Result.Skipped) ) } + + "evaluatePair (failFast=true)"- { + val check = new TestEvaluator(pair, failFast = true) + check.fail( + pair.down, + expectedFailCount = 0, + expectedRawValues = Seq(Result.Success(0)) + ) + + pair.up.failure = Some("lols") + + check.fail( + pair.down, + expectedFailCount = 1, + expectedRawValues = Seq(Result.Aborted) + ) + + pair.up.failure = None + + check.fail( + pair.down, + expectedFailCount = 0, + expectedRawValues = Seq(Result.Success(0)) + ) + + pair.up.exception = Some(new IndexOutOfBoundsException()) + + check.fail( + pair.down, + expectedFailCount = 1, + expectedRawValues = Seq(Result.Aborted) + ) + } + 'evaluateBacktickIdentifiers - { val check = new TestEvaluator(bactickIdentifiers) import bactickIdentifiers._ @@ -112,6 +146,41 @@ object FailureTests extends TestSuite{ expectedRawValues = Seq(Result.Skipped) ) } + + "evaluateBacktickIdentifiers (failFast=true)" - { + val check = new TestEvaluator(bactickIdentifiers, failFast = true) + import bactickIdentifiers._ + check.fail( + `a-down-target`, + expectedFailCount = 0, + expectedRawValues = Seq(Result.Success(0)) + ) + + `up-target`.failure = Some("lols") + + check.fail( + `a-down-target`, + expectedFailCount = 1, + expectedRawValues = Seq(Result.Aborted) + ) + + `up-target`.failure = None + + check.fail( + `a-down-target`, + expectedFailCount = 0, + expectedRawValues = Seq(Result.Success(0)) + ) + + `up-target`.exception = Some(new IndexOutOfBoundsException()) + + check.fail( + `a-down-target`, + expectedFailCount = 1, + expectedRawValues = Seq(Result.Aborted) + ) + } + 'multipleUsesOfDest - { object build extends TestUtil.BaseModule { // Using `T.ctx( ).dest` twice in a single task is ok diff --git a/main/test/src/util/TestEvaluator.scala b/main/test/src/util/TestEvaluator.scala index 81c8fe12..97be20be 100644 --- a/main/test/src/util/TestEvaluator.scala +++ b/main/test/src/util/TestEvaluator.scala @@ -17,7 +17,7 @@ object TestEvaluator{ } } -class TestEvaluator(module: TestUtil.BaseModule) +class TestEvaluator(module: TestUtil.BaseModule, failFast: Boolean = false) (implicit fullName: sourcecode.FullName, tp: TestPath){ val outPath = TestUtil.getOutPath() @@ -27,7 +27,7 @@ class TestEvaluator(module: TestUtil.BaseModule) colored = true, disableTicker=false, ammonite.util.Colors.Default, System.out, System.out, System.err, System.in, debugEnabled = false ) - val evaluator = new Evaluator(Ctx.defaultHome, outPath, TestEvaluator.externalOutPath, module, logger) + val evaluator = new Evaluator(Ctx.defaultHome, outPath, TestEvaluator.externalOutPath, module, logger, failFast = failFast) def apply[T](t: Task[T]): Either[Result.Failing[T], (T, Int)] = { val evaluated = evaluator.evaluate(Agg(t)) |