-
Notifications
You must be signed in to change notification settings - Fork 91
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
Showing
12 changed files
with
71 additions
and
77 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
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
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
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
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,11 +1,40 @@ | ||
package munit | ||
|
||
import munit.internal.console.Printers | ||
|
||
// class Clues(val values: List[Clue[_]]) { | ||
// override def toString(): String = Printers.print(this) | ||
// } | ||
// object Clues { | ||
// def empty: Clues = new Clues(List()) | ||
// def fromValue[T](value: T): Clues = new Clues(List(Clue.fromValue(value))) | ||
// } | ||
import munit.diff.console.Printers | ||
import munit.diff.NextPrintable | ||
|
||
class Clues(val values: List[Clue[_]]) extends NextPrintable { | ||
|
||
override def print( | ||
out: StringBuilder, | ||
indent: Int, | ||
continue: (Any, Int) => Unit | ||
): Unit = { | ||
val nextIndent = indent + Printers.indentStep | ||
Printers.printApply( | ||
"Clues", | ||
values.iterator, | ||
out, | ||
indent, | ||
nextIndent, | ||
open = " {", | ||
close = "}", | ||
comma = "" | ||
) { clue => | ||
if (clue.source.nonEmpty) { | ||
out.append(clue.source) | ||
} | ||
if (clue.valueType.nonEmpty) { | ||
out.append(": ").append(clue.valueType) | ||
} | ||
out.append(" = ") | ||
continue(clue.value, nextIndent) | ||
} | ||
} | ||
|
||
override def toString(): String = Printers.print(this) | ||
} | ||
object Clues { | ||
def empty: Clues = new Clues(List()) | ||
def fromValue[T](value: T): Clues = new Clues(List(Clue.fromValue(value))) | ||
} |
2 changes: 1 addition & 1 deletion
2
munit/shared/src/main/scala/munit/internal/MacroCompatScala2.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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
scala-diff/shared/src/main/scala/munit/diff/NextPrintable.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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package munit.diff | ||
|
||
/** | ||
* Don't override this ever | ||
*/ | ||
trait NextPrintable { | ||
def print(out: StringBuilder, indent: Int, continue: (Any, Int) => Unit): Unit | ||
} |
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
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