testutil

package
v0.0.0-...-1cf9f48 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileInTempDir

func CompileInTempDir(t testing.TB) (tmpDir string, execPath string)

CompileInTempDir creates a temp directory and compiles the main package of the current directory. Remember to delete the directory after the test:

defer os.RemoveAll(tmpDir)

The first argument of the environment variable EXECPATH overrides execPath.

Types

type FakeStdin

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

FakeStdin implements io.Reader and returns predefined list of answers, suitable for mocking standard input.

func NewFakeStdin

func NewFakeStdin(answers ...string) *FakeStdin

NewFakeStdin creates new FakeStdin value with given answers.

func (*FakeStdin) Count

func (fs *FakeStdin) Count() int

Count returns how many answers have been read.

This counter overflows and never returns value bigger than the count of given answers.

func (*FakeStdin) Overflowed

func (fs *FakeStdin) Overflowed() bool

Overflowed reports whether more reads happened than expected.

func (*FakeStdin) Read

func (fs *FakeStdin) Read(p []byte) (int, error)

Read answers one by one and keep record whether the stdin has overflowed.

Jump to

Keyboard shortcuts

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