Printer

munit.diff.Printer
See thePrinter companion trait
object Printer

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Printer.type

Members list

Value members

Concrete methods

def apply(height: Int)(partialPrint: PartialFunction[Any, String]): Printer
def apply(partialPrint: PartialFunction[Any, String]): Printer

Utiliy constructor defining a printer for some types.

Utiliy constructor defining a printer for some types.

Example use case is overriding the string repr for types which default pretty-printers do not output helpful diffs.

type ByteArray = Array[Byte]
val listPrinter = Printer.apply {
 case ll: ByteArray => ll.map(String.format("%02x", b)).mkString(" ")
}
val bytes = Array[Byte](1, 5, 8, 24)
Printers.print(bytes, listPrinter) // "01 05 08 18"

Attributes

Concrete fields

val defaultHeight: Int