test

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPanic

func CheckPanic(t *testing.T, fn func(), contains string) bool

CheckPanic checks that fn() panics and that the panic() arg is a string that contains contains.

func EqualBool

func EqualBool(t *testing.T, got, expected bool, args ...interface{}) bool

EqualBool checks that got equals expected.

func EqualErrorMessage

func EqualErrorMessage(t *testing.T, got, expected interface{},
	args ...interface{})

EqualErrorMessage prints a test error message of the form:

Message
Failed test
       got: got_value
  expected: expected_value

func EqualInt

func EqualInt(t *testing.T, got, expected int, args ...interface{}) bool

EqualInt checks that got equals expected.

func EqualStr

func EqualStr(t *testing.T, got, expected string, args ...interface{}) bool

EqualStr checks that got equals expected.

func IsFalse

func IsFalse(t *testing.T, got bool, args ...interface{}) bool

IsFalse checks that got is false.

func IsTrue

func IsTrue(t *testing.T, got bool, args ...interface{}) bool

IsTrue checks that got is true.

Types

type TestingT

type TestingT struct {
	LastMessage string
	IsFatal     bool
	HasFailed   bool
}

TestingT is a type implementing td.TestingT intended to be used in tests.

func NewTestingT added in v1.2.0

func NewTestingT() *TestingT

NewTestingT returns a new instance of *TestingT.

func (*TestingT) Error

func (t *TestingT) Error(args ...interface{})

Fatal mocks testing.T Error method.

func (*TestingT) Fatal

func (t *TestingT) Fatal(args ...interface{})

Fatal mocks testing.T Fatal method.

func (*TestingT) Helper

func (t *TestingT) Helper()

Helper mocks testing.T Helper method.

type TestingTB added in v1.6.0

type TestingTB struct {
	TestingT

	testing.TB
	// contains filtered or unexported fields
}

TestingTB is a type implementing testing.TB intended to be used in tests.

func NewTestingTB added in v1.6.0

func NewTestingTB(name string) *TestingTB

NewTestingTB returns a new instance of *TestingTB.

func (*TestingTB) Cleanup added in v1.6.0

func (t *TestingTB) Cleanup(fn func())

Cleanup mocks testing.T Cleanup method. Not thread-safe but we don't care in tests.

func (*TestingTB) Error added in v1.6.0

func (t *TestingTB) Error(args ...interface{})

Fatal mocks testing.T Error method.

func (*TestingTB) Errorf added in v1.6.0

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

Errorf mocks testing.T Errorf method.

func (*TestingTB) Fail added in v1.6.0

func (t *TestingTB) Fail()

Fail mocks testing.T Fail method.

func (*TestingTB) FailNow added in v1.6.0

func (t *TestingTB) FailNow()

FailNow mocks testing.T FailNow method.

func (*TestingTB) Failed added in v1.6.0

func (t *TestingTB) Failed() bool

Failed mocks testing.T Failed method.

func (*TestingTB) Fatal added in v1.6.0

func (t *TestingTB) Fatal(args ...interface{})

Fatal mocks testing.T Fatal method.

func (*TestingTB) Fatalf added in v1.6.0

func (t *TestingTB) Fatalf(format string, args ...interface{})

Fatalf mocks testing.T Fatalf method.

func (*TestingTB) Helper added in v1.6.0

func (t *TestingTB) Helper()

Helper mocks testing.T Helper method.

func (*TestingTB) Log added in v1.6.0

func (t *TestingTB) Log(args ...interface{})

Log mocks testing.T Log method.

func (*TestingTB) Logf added in v1.6.0

func (t *TestingTB) Logf(format string, args ...interface{})

Logf mocks testing.T Logf method.

func (*TestingTB) Name added in v1.6.0

func (t *TestingTB) Name() string

Name mocks testing.T Name method.

func (*TestingTB) Skip added in v1.6.0

func (t *TestingTB) Skip(args ...interface{})

Skip mocks testing.T Skip method.

func (*TestingTB) SkipNow added in v1.6.0

func (t *TestingTB) SkipNow()

SkipNow mocks testing.T SkipNow method.

func (*TestingTB) Skipf added in v1.6.0

func (t *TestingTB) Skipf(format string, args ...interface{})

Skipf mocks testing.T Skipf method.

func (*TestingTB) Skipped added in v1.6.0

func (t *TestingTB) Skipped() bool

Skipped mocks testing.T Skipped method.

Jump to

Keyboard shortcuts

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