ptytest

package
v2.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PTY

type PTY struct {
	pty.PTY
	// contains filtered or unexported fields
}

func New

func New(t *testing.T, opts ...pty.Option) *PTY

func (*PTY) Attach

func (p *PTY) Attach(inv *serpent.Invocation) *PTY

func (*PTY) Close

func (p *PTY) Close() error

func (*PTY) ExpectMatch

func (e *PTY) ExpectMatch(str string) string

func (*PTY) ExpectMatchContext

func (e *PTY) ExpectMatchContext(ctx context.Context, str string) string

TODO(mafredri): Rename this to ExpectMatch when refactoring.

func (*PTY) ExpectNoMatchBefore

func (e *PTY) ExpectNoMatchBefore(ctx context.Context, match, before string) string

ExpectNoMatchBefore validates that `match` does not occur before `before`.

func (*PTY) ExpectRegexMatch added in v2.10.0

func (e *PTY) ExpectRegexMatch(str string) string

func (*PTY) ExpectRegexMatchContext added in v2.10.0

func (e *PTY) ExpectRegexMatchContext(ctx context.Context, str string) string

func (*PTY) Peek

func (e *PTY) Peek(ctx context.Context, n int) []byte

func (*PTY) ReadLine

func (e *PTY) ReadLine(ctx context.Context) string

func (*PTY) ReadRune

func (e *PTY) ReadRune(ctx context.Context) rune

func (*PTY) Write

func (p *PTY) Write(r rune)

func (*PTY) WriteLine

func (p *PTY) WriteLine(str string)

type PTYCmd

type PTYCmd struct {
	pty.PTYCmd
	// contains filtered or unexported fields
}

func Start

func Start(t *testing.T, cmd *pty.Cmd, opts ...pty.StartOption) (*PTYCmd, pty.Process)

Start starts a new process asynchronously and returns a PTYCmd and Process. It kills the process and PTYCmd upon cleanup

func (*PTYCmd) Close

func (p *PTYCmd) Close() error

func (*PTYCmd) ExpectMatch

func (e *PTYCmd) ExpectMatch(str string) string

func (*PTYCmd) ExpectMatchContext

func (e *PTYCmd) ExpectMatchContext(ctx context.Context, str string) string

TODO(mafredri): Rename this to ExpectMatch when refactoring.

func (*PTYCmd) ExpectNoMatchBefore

func (e *PTYCmd) ExpectNoMatchBefore(ctx context.Context, match, before string) string

ExpectNoMatchBefore validates that `match` does not occur before `before`.

func (*PTYCmd) ExpectRegexMatch added in v2.10.0

func (e *PTYCmd) ExpectRegexMatch(str string) string

func (*PTYCmd) ExpectRegexMatchContext added in v2.10.0

func (e *PTYCmd) ExpectRegexMatchContext(ctx context.Context, str string) string

func (*PTYCmd) Peek

func (e *PTYCmd) Peek(ctx context.Context, n int) []byte

func (*PTYCmd) ReadLine

func (e *PTYCmd) ReadLine(ctx context.Context) string

func (*PTYCmd) ReadRune

func (e *PTYCmd) ReadRune(ctx context.Context) rune

Jump to

Keyboard shortcuts

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