fixtures

package
v0.0.0-...-0fadc07 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertNoError

func AssertNoError(t TestingT, err error)

AssertNoError is like assert.NoError, but properly formats attached error stack traces.

func RequireNoError

func RequireNoError(t TestingT, err error)

RequireNoError is like require.NoError, but properly formats attached error stack traces.

func RunSuite

func RunSuite(t TestingT, s Suite)

RunSuite runs a test suite.

Types

type AfterSuite

type AfterSuite interface {
	AfterSuite(context.Context)
}

AfterSuite represents a method invoked after completing a test suite.

type AfterTest

type AfterTest interface {
	AfterTest(context.Context)
}

AfterTest represents a method invoked after each test method in a suite.

type BeforeSuite

type BeforeSuite interface {
	BeforeSuite(context.Context) context.Context
}

BeforeSuite describes a method invoked before starting a test suite.

type BeforeTest

type BeforeTest interface {
	BeforeTest(context.Context, TestingT) context.Context
}

BeforeTest represents a method invoked before each test method in a suite.

type Mixin

type Mixin struct {
}

Mixin can be embedded to implement the Suite interface.

func (Mixin) IsSuite

func (Mixin) IsSuite()

IsSuite implements the Suite interface.

type OutputCapture

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

OutputCapture can be used to capture standard output and standard error.

func CaptureOutput

func CaptureOutput() *OutputCapture

CaptureOutput captures the output in tests. Always defer OutputCapture.Close() right after CaptureOutput is called.

func (*OutputCapture) Close

func (c *OutputCapture) Close()

Close finalizes the capture by flushing/caching all buffers and restoring the original stdout/sterr.

func (*OutputCapture) GetErr

func (c *OutputCapture) GetErr() []byte

GetErr calls Close and returns the captured standard error.

func (*OutputCapture) GetErrString

func (c *OutputCapture) GetErrString() string

GetErrString calls Close and returns the captured standard error as string.

func (*OutputCapture) GetOut

func (c *OutputCapture) GetOut() []byte

GetOut calls Close and returns the captured standard output.

func (*OutputCapture) GetOutString

func (c *OutputCapture) GetOutString() string

GetOutString calls Close and returns the captured standard output as string.

type Suite

type Suite interface {
	IsSuite()
}

Suite describes a struct that can be used as test suite.

type TestingT

type TestingT interface {
	Cleanup(f func())
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Fail()
	FailNow()
	Failed() bool
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
	Helper()
	Log(args ...interface{})
	Logf(format string, args ...interface{})
	Name() string
	Run(name string, f func(t *testing.T)) bool
	Skip(args ...interface{})
	SkipNow()
	Skipf(format string, args ...interface{})
	Skipped() bool
	TempDir() string
}

TestingT covers most of the *testing.T methods.

Directories

Path Synopsis
internal
fixturesmocks
Package fixturesmocks is a generated GoMock package.
Package fixturesmocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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