test

fun CliktCommand.test(argv: String, stdin: String = "", envvars: Map<String, String> = emptyMap(), includeSystemEnvvars: Boolean = false, ansiLevel: AnsiLevel = AnsiLevel.NONE, width: Int = 79, height: Int = 24): CliktCommandTestResult
@JvmName(name = "varargTest")
fun CliktCommand.test(vararg argv: String, stdin: String = "", envvars: Map<String, String> = emptyMap(), includeSystemEnvvars: Boolean = false, ansiLevel: AnsiLevel = AnsiLevel.NONE, width: Int = 79, height: Int = 24): CliktCommandTestResult
fun CliktCommand.test(argv: Array<String>, stdin: String = "", envvars: Map<String, String> = emptyMap(), includeSystemEnvvars: Boolean = false, ansiLevel: AnsiLevel = AnsiLevel.NONE, width: Int = 79, height: Int = 24): CliktCommandTestResult
fun CliktCommand.test(argv: List<String>, stdin: String = "", envvars: Map<String, String> = emptyMap(), includeSystemEnvvars: Boolean = false, ansiLevel: AnsiLevel = AnsiLevel.NONE, width: Int = 79, height: Int = 24): CliktCommandTestResult

Test this command, returning a result that captures the output and result status code.

Note that only output printed with echo will be captured. Anything printed with print or println is not.

Parameters

argv

The command line to send to the command

stdin

Content of stdin that will be read by prompt options. Multiple inputs should be separated by \n.

envvars

A map of environment variable name to value for envvars that can be read by the command

includeSystemEnvvars

Set to true to include the environment variables from the system in addition to those defined in envvars

ansiLevel

Defaults to no colored output; set to AnsiLevel.TRUECOLOR to include ANSI codes in the output.

width

The width of the terminal, used to wrap text

height

The height of the terminal