From d1993bcabb3dfe3c02d67dec78ec0715bbe6b0ff Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Mon, 30 Sep 2019 02:09:02 -0400 Subject: [PATCH] use hedgehog.Result --- main/src/test/scala/Delegates.scala | 10 +++++----- main/src/test/scala/ParseKey.scala | 8 ++++---- main/src/test/scala/ParserSpec.scala | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/main/src/test/scala/Delegates.scala b/main/src/test/scala/Delegates.scala index 73249a69a..4ec47c152 100644 --- a/main/src/test/scala/Delegates.scala +++ b/main/src/test/scala/Delegates.scala @@ -9,7 +9,7 @@ package sbt import sbt.internal.util.Types.idFun import sbt.internal.TestBuild._ -import hedgehog.{ Result => Assert, _ } +import hedgehog._ import hedgehog.Result.{ all, assert, failure, success } import hedgehog.runner._ @@ -116,14 +116,14 @@ object Delegates extends Properties { ) ) - def allAxes(f: (Scope, Seq[Scope], Scope => ScopeAxis[_]) => Assert): Property = + def allAxes(f: (Scope, Seq[Scope], Scope => ScopeAxis[_]) => hedgehog.Result): Property = keysGen.forAll.map { keys => allDelegates(keys) { (s, ds) => all(List(f(s, ds, _.project), f(s, ds, _.config), f(s, ds, _.task), f(s, ds, _.extra))) } } - def allDelegates(keys: TestKeys)(f: (Scope, Seq[Scope]) => Assert): Assert = + def allDelegates(keys: TestKeys)(f: (Scope, Seq[Scope]) => hedgehog.Result): hedgehog.Result = all(keys.scopes.map { scope => val delegates = keys.env.delegates(scope) f(scope, delegates) @@ -131,14 +131,14 @@ object Delegates extends Properties { .log("Delegates:\n\t" + delegates.map(scope => Scope.display(scope, "_")).mkString("\n\t")) }.toList) - def alwaysZero(s: Scope, ds: Seq[Scope], axis: Scope => ScopeAxis[_]): Assert = + def alwaysZero(s: Scope, ds: Seq[Scope], axis: Scope => ScopeAxis[_]): hedgehog.Result = assert(axis(s) != Zero).or( all(ds.map { d => axis(d) ==== Zero }.toList) ) - def globalCombinations(s: Scope, ds: Seq[Scope]): Assert = { + def globalCombinations(s: Scope, ds: Seq[Scope]): hedgehog.Result = { val mods = List[Scope => Scope]( _.copy(project = Zero), _.copy(config = Zero), diff --git a/main/src/test/scala/ParseKey.scala b/main/src/test/scala/ParseKey.scala index 05ca86635..343e0bfe2 100644 --- a/main/src/test/scala/ParseKey.scala +++ b/main/src/test/scala/ParseKey.scala @@ -11,7 +11,7 @@ import sbt.Def.{ ScopedKey, displayFull, displayMasked } import sbt.internal.TestBuild._ import sbt.internal.util.complete.Parser import sbt.internal.{ Resolve, TestBuild } -import hedgehog.{ Result => Assert, _ } +import hedgehog._ import hedgehog.core.{ ShrinkLimit, SuccessCount } import hedgehog.runner._ @@ -64,7 +64,7 @@ object ParseKey extends Properties { val expected = resolve(structure, key, mask) parseCheck(structure, key, mask, showZeroConfig)( sk => - Assert + hedgehog.Result .assert(Project.equal(sk, expected, mask)) .log(s"$sk.key == $expected.key: ${sk.key == expected.key}") .log(s"${sk.scope} == ${expected.scope}: ${Scope.equal(sk.scope, expected.scope, mask)}") @@ -163,13 +163,13 @@ object ParseKey extends Properties { key: ScopedKey[_], mask: ScopeMask, showZeroConfig: Boolean = false, - )(f: ScopedKey[_] => Assert): Assert = { + )(f: ScopedKey[_] => hedgehog.Result): hedgehog.Result = { val s = displayMasked(key, mask, showZeroConfig) val parser = makeParser(structure) val parsed = Parser.result(parser, s).left.map(_().toString) ( parsed - .fold(_ => Assert.failure, f) + .fold(_ => hedgehog.Result.failure, f) .log(s"Key: ${Scope.displayPedantic(key.scope, key.key.label)}") .log(s"Mask: $mask") .log(s"Key string: '$s'") diff --git a/main/src/test/scala/ParserSpec.scala b/main/src/test/scala/ParserSpec.scala index 342fe9bea..5022fa9d3 100644 --- a/main/src/test/scala/ParserSpec.scala +++ b/main/src/test/scala/ParserSpec.scala @@ -5,10 +5,11 @@ * Licensed under Apache License 2.0 (see LICENSE) */ +package sbt + import java.net.URI import sbt.Def._ -import sbt._ import sbt.internal.TestBuild import sbt.internal.TestBuild._ import sbt.internal.util.AttributeKey