elvish: github.com/elves/elvish/pkg/prog/progtest Index | Files

package progtest

import "github.com/elves/elvish/pkg/prog/progtest"

Package progtest provides utilities for testing subprograms.

This package intentionally has no test file; it is excluded from test coverage.


Package Files


func Elvish Uses

func Elvish(args ...string) []string

Elvish returns an argument slice starting with "elvish".

func MustWriteFile Uses

func MustWriteFile(name, content string)

MustWriteFile writes a file with the given name and content. It panics if the write fails.

func TestError Uses

func TestError(t *testing.T, f *Fixture, exit int, wantErrSnippet string)

TestError tests the error result of a program.

type Fixture Uses

type Fixture struct {
    // contains filtered or unexported fields

Fixture is a test fixture suitable for testing programs.

func Setup Uses

func Setup() *Fixture

Setup sets up a test fixture. The caller is responsible for calling the Cleanup method of the returned Fixture.

func (*Fixture) Cleanup Uses

func (f *Fixture) Cleanup()

Cleanup cleans up the test fixture.

func (*Fixture) Fds Uses

func (f *Fixture) Fds() [3]*os.File

Fds returns the file descriptors in the fixture.

func (*Fixture) FeedIn Uses

func (f *Fixture) FeedIn(s string)

FeedIn feeds input to the standard input.

func (*Fixture) TestOut Uses

func (f *Fixture) TestOut(t *testing.T, fd int, wantOut string)

TestOut tests that the output on the given FD matches the given text.

func (*Fixture) TestOutSnippet Uses

func (f *Fixture) TestOutSnippet(t *testing.T, fd int, wantOutSnippet string)

TestOutSnippet tests that the output on the given FD contains the given text.

Package progtest imports 5 packages (graph). Updated 2020-04-28. Refresh now. Tools for package owners.