Documentation
¶
Index ¶
- func CheckPanic(t *testing.T, fn func(), contains string) bool
- func EqualBool(t *testing.T, got, expected bool, args ...any) bool
- func EqualErrorMessage(t *testing.T, got, expected any, args ...any)
- func EqualInt(t *testing.T, got, expected int, args ...any) bool
- func EqualStr(t *testing.T, got, expected string, args ...any) bool
- func Error(t *testing.T, err error, args ...any) bool
- func IsFalse(t *testing.T, got bool, args ...any) bool
- func IsTrue(t *testing.T, got bool, args ...any) bool
- func NoError(t *testing.T, err error, args ...any) bool
- type ParallelTestingTB
- type TestingT
- func (t *TestingT) CatchFatal(fn func()) (fatalStr string)
- func (t *TestingT) ContainsMessages(expectedMsgs ...string) []string
- func (t *TestingT) Error(args ...any)
- func (t *TestingT) Fatal(args ...any)
- func (t *TestingT) Helper()
- func (t *TestingT) LastMessage() string
- func (t *TestingT) ResetMessages()
- type TestingTB
- func (t *TestingTB) Cleanup(fn func())
- func (t *TestingTB) Error(args ...any)
- func (t *TestingTB) Errorf(format string, args ...any)
- func (t *TestingTB) Fail()
- func (t *TestingTB) FailNow()
- func (t *TestingTB) Failed() bool
- func (t *TestingTB) Fatal(args ...any)
- func (t *TestingTB) Fatalf(format string, args ...any)
- func (t *TestingTB) Helper()
- func (t *TestingTB) Log(args ...any)
- func (t *TestingTB) Logf(format string, args ...any)
- func (t *TestingTB) Name() string
- func (t *TestingTB) Skip(args ...any)
- func (t *TestingTB) SkipNow()
- func (t *TestingTB) Skipf(format string, args ...any)
- func (t *TestingTB) Skipped() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPanic ¶
CheckPanic checks that fn() panics and that the panic() arg is a string that contains contains.
func EqualErrorMessage ¶
EqualErrorMessage prints a test error message of the form:
Message Failed test got: got_value expected: expected_value
Types ¶
type ParallelTestingTB ¶ added in v1.10.0
ParallelTestingTB is a type implementing testing.TB and a Parallel() method intended to be used in tests.
func NewParallelTestingTB ¶ added in v1.10.0
func NewParallelTestingTB(name string) *ParallelTestingTB
NewParallelTestingTB returns a new instance of *ParallelTestingTB.
func (*ParallelTestingTB) Parallel ¶ added in v1.10.0
func (t *ParallelTestingTB) Parallel()
Parallel mocks the testing.T.Parallel method. Not thread-safe.
type TestingT ¶
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) CatchFatal ¶ added in v1.10.0
func (*TestingT) ContainsMessages ¶ added in v1.12.0
ContainsMessages checks expectedMsgs are all present in Messages, in this order. It stops when a message is not found and returns the remaining messages.
func (*TestingT) LastMessage ¶
LastMessage returns the last message.
func (*TestingT) ResetMessages ¶ added in v1.9.0
func (t *TestingT) ResetMessages()
ResetMessages resets the messages.
type TestingTB ¶ added in v1.6.0
TestingTB is a type implementing testing.TB intended to be used in tests.
func NewTestingTB ¶ added in v1.6.0
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
Fatal mocks testing.T.Error method.
func (*TestingTB) Errorf ¶ added in v1.6.0
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
Failed mocks testing.T.Failed method.
func (*TestingTB) Fatal ¶ added in v1.6.0
Fatal mocks testing.T.Fatal method.
func (*TestingTB) Fatalf ¶ added in v1.6.0
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
Log mocks testing.T.Log method.
func (*TestingTB) Logf ¶ added in v1.6.0
Logf mocks testing.T.Logf method.
func (*TestingTB) Name ¶ added in v1.6.0
Name mocks testing.T.Name method.
func (*TestingTB) Skip ¶ added in v1.6.0
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
Skipf mocks testing.T.Skipf method.
func (*TestingTB) Skipped ¶ added in v1.6.0
Skipped mocks testing.T.Skipped method.