Documentation
¶
Overview ¶
Package goassert provides an assertion framework making your testing easier and happier
Index ¶
- type Assert
- func (assert *Assert) Equal(actual ...interface{})
- func (assert *Assert) EqualWithoutError(actualErr ...interface{})
- func (assert *Assert) ExpectError(_err ...interface{})
- func (assert *Assert) ExpectPanic(callback func())
- func (assert *Assert) SucceedNew(o interface{}, err error) interface{}
- func (assert *Assert) SucceedWithoutError(err error)
- type HookedTestingTB
- func (tb *HookedTestingTB) Error(args ...interface{})
- func (tb *HookedTestingTB) Errorf(format string, args ...interface{})
- func (tb *HookedTestingTB) Fail()
- func (tb *HookedTestingTB) FailNow()
- func (tb *HookedTestingTB) Failed() bool
- func (tb *HookedTestingTB) Fatal(args ...interface{})
- func (tb *HookedTestingTB) Fatalf(format string, args ...interface{})
- func (tb *HookedTestingTB) Helper()
- func (tb *HookedTestingTB) Log(args ...interface{})
- func (tb *HookedTestingTB) Logf(format string, args ...interface{})
- func (tb *HookedTestingTB) Name() string
- type TestingTB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assert ¶
type Assert struct {
// contains filtered or unexported fields
}
Assert is an assertion wrapper.
func (*Assert) Equal ¶
func (assert *Assert) Equal(actual ...interface{})
Equal checks that the given actual values equals the expected values.
func (*Assert) EqualWithoutError ¶
func (assert *Assert) EqualWithoutError(actualErr ...interface{})
EqualWithoutError checks that the given actual values equals the expected values without any error.
func (*Assert) ExpectError ¶
func (assert *Assert) ExpectError(_err ...interface{})
ExpectError checks that the error is returned expectedly. The expected values must be none or one error pattern string.
func (*Assert) ExpectPanic ¶
func (assert *Assert) ExpectPanic(callback func())
ExpectPanic checks that panic is called at least once. The expected values must be one expected object passed to panic.
func (*Assert) SucceedNew ¶
SucceedNew checks that New-style function succeeds without any error.
func (*Assert) SucceedWithoutError ¶
SucceedWithoutError check that the function succeeds without any error.
type HookedTestingTB ¶
type HookedTestingTB struct {
// Messages is the slice of the logged messages.
Messages []string
// Helpers is the slice of the registered helper functions.
// Helper functions are identified by string "file:line".
Helpers []string
// contains filtered or unexported fields
}
HookedTestingTB implements TestingTB. This is designed to be used in testing test frameworks.
func NewHookedTestingTB ¶
func NewHookedTestingTB(name string) *HookedTestingTB
NewHookedTestingTB returns a new HookedTestingTB.
func (*HookedTestingTB) Error ¶
func (tb *HookedTestingTB) Error(args ...interface{})
Error is for interface TestingTB.
func (*HookedTestingTB) Errorf ¶
func (tb *HookedTestingTB) Errorf(format string, args ...interface{})
Errorf is for interface TestingTB.
func (*HookedTestingTB) FailNow ¶
func (tb *HookedTestingTB) FailNow()
FailNow is for interface TestingTB.
func (*HookedTestingTB) Failed ¶
func (tb *HookedTestingTB) Failed() bool
Failed is for interface TestingTB.
func (*HookedTestingTB) Fatal ¶
func (tb *HookedTestingTB) Fatal(args ...interface{})
Fatal is for interface TestingTB.
func (*HookedTestingTB) Fatalf ¶
func (tb *HookedTestingTB) Fatalf(format string, args ...interface{})
Fatalf is for interface TestingTB.
func (*HookedTestingTB) Helper ¶
func (tb *HookedTestingTB) Helper()
Helper is for interface TestingTB.
func (*HookedTestingTB) Log ¶
func (tb *HookedTestingTB) Log(args ...interface{})
Log is for interface TestingTB.
func (*HookedTestingTB) Logf ¶
func (tb *HookedTestingTB) Logf(format string, args ...interface{})
Logf is for interface TestingTB.
func (*HookedTestingTB) Name ¶
func (tb *HookedTestingTB) Name() string
Name is for interface TestingTB.
type TestingTB ¶
type TestingTB interface {
Error(args ...interface{})
Errorf(format string, args ...interface{})
Fail()
FailNow()
Failed() bool
Fatal(args ...interface{})
Fatalf(format string, args ...interface{})
Log(args ...interface{})
Logf(format string, args ...interface{})
Name() string
Helper()
}
TestingTB is an interface mimicking testing.TB (except for Skip*) interface which prevents users to implement itself. See testing.TB for details.