consoletest

package
v0.49.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunTestConsole

func RunTestConsole(
	t *testing.T,
	setup func(out FileWriter, in FileReader) error,
	procedure func(c ExpectConsole),
)

RunTestConsole simulates a terminal for interactive tests This is mostly a adaptation of the RunTest function at [survey_test.go](https://github.com/AlecAivazis/survey/blob/e47352f914346a910cc7e1ca9f65a7ac0674449a/survey_posix_test.go#L15), but with interfaces exported to easy re-use on other packages.

Types

type ExpectConsole

type ExpectConsole interface {
	ExpectEOF()
	ExpectString(string)
	Send(string)
	SendLine(string)
}

ExpectConsole is a helper to interact if the pseudo terminal on tests

type FileReader

type FileReader interface {
	io.Reader
	Fd() uintptr
}

FileReader is a simplification of the io.Stdin struct

type FileWriter

type FileWriter interface {
	io.Writer
	Fd() uintptr
}

FileWriter is a simplification of the io.Stdout struct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL