TerminalRecorder

A TerminalInterface that records all output and allows you to provide input.

Exmaple

val recorder = TerminalRecorder()
val t = Terminal(terminalInterface = recorder)
t.println("Hello, world!")
assertEquals(recorder.output(), "Hello, world!\n")

Constructors

Link copied to clipboard
constructor(ansiLevel: AnsiLevel = AnsiLevel.TRUECOLOR, width: Int = 79, height: Int = 24, hyperlinks: Boolean = ansiLevel != AnsiLevel.NONE, outputInteractive: Boolean = ansiLevel != AnsiLevel.NONE, inputInteractive: Boolean = ansiLevel != AnsiLevel.NONE, crClearsLine: Boolean = false)

Properties

Link copied to clipboard
open override val info: TerminalInfo

Information about the current terminal.

Link copied to clipboard

Lines of input to return from readLineOrNull.

Functions

Link copied to clipboard
Link copied to clipboard
open override fun completePrintRequest(request: PrintRequest)

Display a PrintRequest on this terminal.

Link copied to clipboard
fun output(): String

The combined content of stdout and stderr

Link copied to clipboard
fun TerminalRecorder.outputAsHtml(includeBodyTag: Boolean = true, includeCodeTag: Boolean = true, backgroundColor: Color? = SRGB("#0c0c0c")): String

Render the contents of this TerminalRecorder as an HTML document.

Link copied to clipboard
open override fun readLineOrNull(hideInput: Boolean): String?

Read a single line of input from stdin, returning null if no input is available

Link copied to clipboard
fun stderr(): String

The content written to stderr

Link copied to clipboard
fun stdout(): String

The content written to stdout