Merge pull request #6 from jozic/updateoptions-tostring

add toString to UpdateOptions
This commit is contained in:
Dale Wijnand 2017-06-27 15:55:05 +01:00 committed by GitHub
commit 7e87603b5f
2 changed files with 35 additions and 0 deletions

View File

@ -67,6 +67,14 @@ final class UpdateOptions private[sbt] (
moduleResolvers
)
override def toString(): String =
s"""UpdateOptions(
| circularDependencyLevel = $circularDependencyLevel,
| latestSnapshots = $latestSnapshots,
| consolidatedResolution = $consolidatedResolution,
| cachedResolution = $cachedResolution
|)""".stripMargin
override def equals(o: Any): Boolean = o match {
case o: UpdateOptions =>
this.circularDependencyLevel == o.circularDependencyLevel &&

View File

@ -0,0 +1,27 @@
package sbt.librarymanagement
import sbt.internal.util.UnitSpec
class UpdateOptionsSpec extends UnitSpec {
"UpdateOptions" should "have proper toString defined" in {
UpdateOptions().toString() should be(
"""|UpdateOptions(
| circularDependencyLevel = warn,
| latestSnapshots = false,
| consolidatedResolution = false,
| cachedResolution = false
|)""".stripMargin)
UpdateOptions()
.withCircularDependencyLevel(CircularDependencyLevel.Error)
.withCachedResolution(true)
.withLatestSnapshots(true).toString() should be(
"""|UpdateOptions(
| circularDependencyLevel = error,
| latestSnapshots = true,
| consolidatedResolution = false,
| cachedResolution = true
|)""".stripMargin)
}
}