Documentation ¶
Overview ¶
Package assert provides some useful assertion methods.
Package assert is a generated GoMock package.
Index ¶
- func Equal(t T, got interface{}, expect interface{}, msg ...string)
- func Error(t T, got error, expr string, msg ...string)
- func False(t T, got bool, msg ...string)
- func Implements(t T, got interface{}, expect interface{}, msg ...string)
- func InMapKeys(t T, got interface{}, expect interface{}, msg ...string)
- func InMapValues(t T, got interface{}, expect interface{}, msg ...string)
- func InSlice(t T, got interface{}, expect interface{}, msg ...string)
- func JsonEqual(t T, got string, expect string, msg ...string)
- func Matches(t T, got string, expr string, msg ...string)
- func Nil(t T, got interface{}, msg ...string)
- func NotEqual(t T, got interface{}, expect interface{}, msg ...string)
- func NotInSlice(t T, got interface{}, expect interface{}, msg ...string)
- func NotNil(t T, got interface{}, msg ...string)
- func NotSame(t T, got interface{}, expect interface{}, msg ...string)
- func Panic(t T, fn func(), expr string, msg ...string)
- func Same(t T, got interface{}, expect interface{}, msg ...string)
- func SubInSlice(t T, got interface{}, expect interface{}, msg ...string)
- func True(t T, got bool, msg ...string)
- func TypeOf(t T, got interface{}, expect interface{}, msg ...string)
- type MockT
- type MockTMockRecorder
- type StringAssertion
- func (a *StringAssertion) Contains(substr string, msg ...string) *StringAssertion
- func (a *StringAssertion) EqualFold(s string, msg ...string)
- func (a *StringAssertion) HasPrefix(prefix string, msg ...string) *StringAssertion
- func (a *StringAssertion) HasSuffix(suffix string, msg ...string) *StringAssertion
- type T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Implements ¶
Implements assertion failed when got doesn't implement expect.
func InMapValues ¶
InMapValues assertion failed when got is not in values of expect map.
func NotInSlice ¶
NotInSlice assertion failed when got is in expect array & slice.
func SubInSlice ¶
SubInSlice assertion failed when got is not sub in expect array & slice.
Types ¶
type MockT ¶
type MockT struct {
// contains filtered or unexported fields
}
MockT is a mock of T interface.
func (*MockT) EXPECT ¶
func (m *MockT) EXPECT() *MockTMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockTMockRecorder ¶
type MockTMockRecorder struct {
// contains filtered or unexported fields
}
MockTMockRecorder is the mock recorder for MockT.
func (*MockTMockRecorder) Error ¶
func (mr *MockTMockRecorder) Error(args ...interface{}) *gomock.Call
Error indicates an expected call of Error.
func (*MockTMockRecorder) Helper ¶
func (mr *MockTMockRecorder) Helper() *gomock.Call
Helper indicates an expected call of Helper.
type StringAssertion ¶
type StringAssertion struct {
// contains filtered or unexported fields
}
StringAssertion assertion for type string.
func String ¶
func String(t T, v string) *StringAssertion
String returns an assertion for type string.
func (*StringAssertion) Contains ¶
func (a *StringAssertion) Contains(substr string, msg ...string) *StringAssertion
Contains assertion failed when v doesn't contain substring `substr`.
func (*StringAssertion) EqualFold ¶
func (a *StringAssertion) EqualFold(s string, msg ...string)
EqualFold assertion failed when v doesn't equal to `s` under Unicode case-folding.
func (*StringAssertion) HasPrefix ¶
func (a *StringAssertion) HasPrefix(prefix string, msg ...string) *StringAssertion
HasPrefix assertion failed when v doesn't have prefix `prefix`.
func (*StringAssertion) HasSuffix ¶
func (a *StringAssertion) HasSuffix(suffix string, msg ...string) *StringAssertion
HasSuffix assertion failed when v doesn't have suffix `suffix`.