tools

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertDeepEqual

func AssertDeepEqual(t TestingT, exp, act interface{}, format string, args ...interface{}) bool

AssertDeepEqual verifies underlying values are deep equal and prints a diff if not

func DeepEqual

func DeepEqual(a, b interface{}) bool

DeepEqual compares underlying values

func RequireDeepEqual

func RequireDeepEqual(t TestingT, exp, act interface{}, format string, args ...interface{}) bool

RequireDeepEqual verifies underlying values are deep equal and prints a diff if not

func Value

func Value(v interface{}) interface{}

Value returns the value of v

Types

type Differ

type Differ interface {
	Print()
	String() string
	WriteTo(w io.Writer) (int64, error)
}

Differ allows different diff strategies to be returned

func Diff

func Diff(a, b interface{}) Differ

Diff creates a Differ for comparing a and b

type TestMock

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

TestMock capture the output normally sent to *testing.T and os.Stdout

func Mock

func Mock() *TestMock

Mock creates a new TestMock

func (*TestMock) Errorf

func (t *TestMock) Errorf(format string, args ...interface{})

Errorf writes error info

func (*TestMock) Fail

func (t *TestMock) Fail()

Fail marks the test as failed

func (*TestMock) FailNow

func (t *TestMock) FailNow()

FailNow marks the test as failed and stops execution

func (*TestMock) Results

func (t *TestMock) Results() *TestResults

Results detaches from stdout and returns the TestResults that capture the info normally sent to testing.T and stdout

type TestResults

type TestResults struct {
	Fail    bool
	FailNow bool
	Err     string
	Out     string
}

TestResults contains the output normally sent to *testing.T and os.Stdout

type TestingT

type TestingT interface {
	Fail()
	FailNow()
	Errorf(format string, args ...interface{})
}

TestingT defines what we require from *t.Testing

Jump to

Keyboard shortcuts

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