Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add toString to UpdateOptions #6

Merged
merged 1 commit into from
Jun 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sbt.librarymanagement

import java.io.File
import org.apache.ivy.plugins.resolver.DependencyResolver
import org.apache.ivy.core.settings.IvySettings
import sbt.util.Logger
Expand Down Expand Up @@ -50,6 +49,14 @@ final class UpdateOptions private[sbt] (
cachedResolution,
resolverConverter)

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)
}
}