-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d46a3f1
commit c99a31b
Showing
4 changed files
with
62 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 9 additions & 4 deletions
13
argonaut/src/main/scala/com/softwaremill/diffx/DiffResultJsArray.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
package com.softwaremill.diffx | ||
|
||
case class DiffResultJsArray(diffs: List[DiffResult]) | ||
extends DiffResultDifferent { | ||
override private[diffx] def showIndented(indent: Int)(implicit c: ConsoleColorConfig): String = { | ||
val showFields = diffs.map(f => s"${f.showIndented(indent)}") | ||
case class DiffResultJsArray(diffs: List[DiffResult]) extends DiffResult { | ||
override private[diffx] def showIndented( | ||
indent: Int, | ||
renderIdentical: Boolean | ||
)(implicit c: ConsoleColorConfig): String = { | ||
val showFields = | ||
diffs.map(f => s"${f.showIndented(indent, renderIdentical)}") | ||
showFields.mkString(s"[\n${i(indent)}", s",\n${i(indent)}", "]") | ||
} | ||
|
||
override def isIdentical: Boolean = diffs.forall(_.isIdentical) | ||
} |
16 changes: 12 additions & 4 deletions
16
argonaut/src/main/scala/com/softwaremill/diffx/DiffResultJson.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
package com.softwaremill.diffx | ||
|
||
case class DiffResultJson(fields: Map[DiffResult, DiffResult]) | ||
extends DiffResultDifferent { | ||
override private[diffx] def showIndented(indent: Int)(implicit c: ConsoleColorConfig): String = { | ||
extends DiffResult { | ||
override private[diffx] def showIndented( | ||
indent: Int, | ||
renderIdentical: Boolean | ||
)(implicit c: ConsoleColorConfig): String = { | ||
val showFields = | ||
fields.map( | ||
f => s"""${i(indent)}"${f._1.show}": ${f._2.showIndented(indent + 5)}""" | ||
fields.map(f => | ||
s"""${i(indent)}"${f._1 | ||
.show()}": ${f._2.showIndented(indent + 5, renderIdentical)}""" | ||
) | ||
showFields.mkString("{\n", ",\n", "}") | ||
} | ||
|
||
override def isIdentical: Boolean = fields.forall { case (k, v) => | ||
k.isIdentical && v.isIdentical | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters