Skip to content

Commit

Permalink
Also add case class prettifying to DefaultPrettifier
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich committed Aug 4, 2022
1 parent a4f061d commit 67665f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Expand Up @@ -345,6 +345,10 @@ class PrettifierSpec extends funspec.AnyFunSpec with matchers.should.Matchers {
it("should pretty print nested string Java Map") {
Prettifier.default(javaSortedMap(Entry("akey", javaSortedMap(Entry(1, "one"), Entry(2, "two"), Entry(3, "three"))))) should be ("{\"akey\"={1=\"one\", 2=\"two\", 3=\"three\"}}")
}
case class CaseClazzWithArray(data: Array[Int])
it("should pretty print data inside a case class") {
Prettifier.default(CaseClazzWithArray(Array(1,2,3))) should be ("CaseClazzWithArray(Array(1, 2, 3))")
}
it("should pretty print xml <a></a>") {
Prettifier.default(<a></a>) should be ("<a></a>")
}
Expand Down
2 changes: 2 additions & 0 deletions jvm/scalactic/src/main/scala/org/scalactic/Prettifier.scala
Expand Up @@ -176,6 +176,8 @@ private[scalactic] class DefaultPrettifier extends Prettifier {
}
else
theToString
case caseClazz: Product =>
s"${caseClazz.productPrefix}(" + caseClazz.productIterator.map(prettify(_, processed + caseClazz)).mkString(", ") + ")"
// SKIP-SCALATESTJS,NATIVE-END
case anythingElse => anythingElse.toString
}
Expand Down

0 comments on commit 67665f7

Please sign in to comment.