termtest

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyEnter  = Key("\r")
	KeyTab    = Key("\t")
	KeyEsc    = Key(string(rune(27)))
	KeyStrC   = Key(string(rune(3)))
	KeyDelete = Key(string(rune(127)))
	KeyUp     = Key("\u001B[A")
	KeyDown   = Key("\u001B[B")
	KeyLeft   = Key("\x1b[D")
	KeyRight  = Key("\x1b[C")
)

Variables

This section is empty.

Functions

func AnsiString added in v1.6.0

func AnsiString(strs ...string) expect.ExpectOpt

func Keys

func Keys(keys ...Key) []string

func RunTerminalTest

func RunTerminalTest(t *testing.T, test func(c *Console), setupFunc func(termutil.Stdio))

RunTerminalTest runs a fake terminal test which catpures all in & output Source: https://github.com/AlecAivazis/survey/blob/master/survey_posix_test.go

Types

type AnsiStringMatcher added in v1.6.0

type AnsiStringMatcher struct {
	// contains filtered or unexported fields
}

AnsiStringMatcher fulfills the Matcher interface to match strings against a given bytes.Buffer.

func (*AnsiStringMatcher) Criteria added in v1.6.0

func (sm *AnsiStringMatcher) Criteria() interface{}

func (*AnsiStringMatcher) Match added in v1.6.0

func (sm *AnsiStringMatcher) Match(v interface{}) bool

type Console

type Console struct {
	// contains filtered or unexported fields
}

func (*Console) ExpectString

func (c *Console) ExpectString(val string)

func (*Console) Send

func (c *Console) Send(val string)

func (*Console) SendKey

func (c *Console) SendKey(val Key)

type Key

type Key string

func (Key) Str

func (k Key) Str() string

Jump to

Keyboard shortcuts

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