EmptyPrinter

object EmptyPrinter extends Printer

Default printer that does not customize the pretty-printer

trait Printer
class Object
trait Matchable
class Any

Value members

Concrete methods

Inherited methods

def height: Int
Inherited from:
Printer
def isMultiline(string: String): Boolean
Inherited from:
Printer
def orElse(other: Printer): Printer

Combine two printers into a single printer.

Combine two printers into a single printer.

Order is important : this printer will be tried first, then the other printer. The new Printer's height will be the max of the two printers' heights.

Example use case : define some default printers for some types for all tests, and override it for some tests only.


case class Person(name: String, age: Int, mail: String)

trait MySuites extends FunSuite {
 override val printer = Printer.apply {
   case Person(name, age, mail) => s"$name:$age:$mail"
   case m: SomeOtherCaseClass => m.someCustomToString
 }
}

trait CompareMailsOnly extends MySuites {
 val mailOnlyPrinter = Printer.apply {
   case Person(_, _, mail) => mail
 }
 override val printer =  mailOnlyPrinterPrinter orElse super.printer
}

Inherited from:
Printer