test

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ProjectRootFlag = "root"

ProjectRootFlag is the name of the project root directory command line flag

Variables

This section is empty.

Functions

func Main

func Main(m *testing.M)

Main is the main entry point form end-to-end tests

func NewLogger

func NewLogger(t *testing.T) log.StdLogger

NewLogger creates a new test logger with standard interface

func Run

func Run(t *testing.T, tests ...Test)

Run runs all test case(s) with the standard test framework

func Sh

func Sh(ctx Context, env []string, stdin *string, prog string, args ...string) (stdout, stderr string, err error)

Sh runs a shell command for tests, see cli.Sh

Types

type Context

type Context interface {
	context.Context
	ID() string
	T() *testing.T
	Log() log.StdLogger
	Cleanup()
	AddCleanup(fn cleanupFunc)
}

Context is a golang context used in tests

func NewContext

func NewContext(parent context.Context, t *testing.T) Context

NewContext creates a new test context

type Test

type Test struct {
	Name    string
	Context Context
	Fn      func(tt Test)
	More    []Test
}

Test is a typical test definition

Jump to

Keyboard shortcuts

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