Skip to content

Commit

Permalink
Merge pull request #6 from jozic/updateoptions-tostring
Browse files Browse the repository at this point in the history
add toString to UpdateOptions
  • Loading branch information
dwijnand authored Jun 27, 2017
2 parents 8782c40 + a217178 commit 7e87603
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
27 changes: 27 additions & 0 deletions librarymanagement/src/test/scala/UpdateOptionsSpec.scala
Original file line number Diff line number Diff line change
@@ -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)
}
}

0 comments on commit 7e87603

Please sign in to comment.