mirror of https://github.com/sbt/sbt.git
Merge pull request #146 from dwijnand/UpdateReport.toString
Make sure UpdateReport has a nice toString
This commit is contained in:
commit
c6e8bd72d2
|
|
@ -30,7 +30,8 @@ final class OrganizationArtifactReport private (
|
|||
37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.OrganizationArtifactReport".##) + organization.##) + name.##) + modules.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"OrganizationArtifactReport(" + organization + ", " + name + ", " + modules + ")"
|
||||
val details = modules map { _.detailReport }
|
||||
s"\t$organization:$name\n${details.mkString}\n"
|
||||
}
|
||||
protected[this] def copy(organization: String = organization, name: String = name, modules: Vector[sbt.librarymanagement.ModuleReport] = modules): OrganizationArtifactReport = {
|
||||
new OrganizationArtifactReport(organization, name, modules)
|
||||
|
|
|
|||
|
|
@ -596,6 +596,10 @@
|
|||
{ "name": "organization", "type": "String" },
|
||||
{ "name": "name", "type": "String" },
|
||||
{ "name": "modules", "type": "sbt.librarymanagement.ModuleReport*" }
|
||||
],
|
||||
"toString": [
|
||||
"val details = modules map { _.detailReport }",
|
||||
"s\"\\t$organization:$name\\n${details.mkString}\\n\""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
package sbt.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
|
||||
import org.scalatest._
|
||||
|
||||
class UpdateReportSpec extends FlatSpec with Matchers {
|
||||
"UpdateReport.toString" should "have a nice toString" in {
|
||||
assert(updateReport.toString === s"""
|
||||
|Update report:
|
||||
| Resolve time: 0 ms, Download time: 0 ms, Download size: 0 bytes
|
||||
| compile:
|
||||
| org:name
|
||||
| - 1.0
|
||||
| evicted: false
|
||||
|
|
||||
|""".stripMargin.drop(1))
|
||||
}
|
||||
|
||||
lazy val updateReport =
|
||||
UpdateReport(
|
||||
new File("cachedDescriptor.data"),
|
||||
Vector(configurationReport),
|
||||
UpdateStats(0, 0, 0, false),
|
||||
Map.empty
|
||||
)
|
||||
|
||||
lazy val configurationReport =
|
||||
ConfigurationReport(
|
||||
ConfigRef("compile"),
|
||||
Vector(moduleReport),
|
||||
Vector(organizationArtifactReport)
|
||||
)
|
||||
|
||||
lazy val moduleReport =
|
||||
ModuleReport(ModuleID("org", "name", "1.0"), Vector.empty, Vector.empty)
|
||||
|
||||
lazy val organizationArtifactReport =
|
||||
OrganizationArtifactReport("org", "name", Vector(moduleReport))
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue