progtest

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package progtest provides utilities for testing subprograms.

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Elvish

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

Elvish returns an argument slice starting with "elvish".

func SetDeprecationLevel

func SetDeprecationLevel(c testutil.Cleanuper, level int)

SetDeprecationLevel sets prog.DeprecationLevel to the given value for the duration of a test.

func TestError

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

TestError tests the error result of a program.

func TestExit

func TestExit(t *testing.T, gotExit, wantExit int)

TestError tests the exit code.

Types

type Fixture

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

Fixture is a test fixture suitable for testing programs.

func Setup

func Setup(c testutil.Cleanuper) *Fixture

Setup sets up a test fixture.

func (*Fixture) Fds

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

Fds returns the file descriptors in the fixture.

func (*Fixture) FeedIn

func (f *Fixture) FeedIn(s string)

FeedIn feeds input to the standard input.

func (*Fixture) TestOut

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

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

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

Jump to

Keyboard shortcuts

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