Documentation ¶
Overview ¶
Package assert provides the assersion feature for *testing.T You can use assert functions by `assert.New(t)`
import ( "testing" "github.com/speedland/go/x/xtesting/assert" ) func TestSomething(t *testing.T){ assert := assert.New(t) assert.OK(true) assert.EqInt(1, 1) assert.EqStr("Expects", "Got", "Somthing wrong!") }
Index ¶
- type Assert
- func (a *Assert) EqByteString(expect string, got []byte, msgContext ...interface{})
- func (a *Assert) EqFloat32(expect, got float32, msgContext ...interface{})
- func (a *Assert) EqFloat64(expect, got float64, msgContext ...interface{})
- func (a *Assert) EqInt(expect, got int, msgContext ...interface{})
- func (a *Assert) EqInt32(expect, got int32, msgContext ...interface{})
- func (a *Assert) EqInt64(expect, got int64, msgContext ...interface{})
- func (a *Assert) EqStr(expect, got string, msgContext ...interface{})
- func (a *Assert) EqTime(expect, got time.Time, msgContext ...interface{})
- func (a *Assert) Failure(expect interface{}, got interface{}, msgContext ...interface{})
- func (a *Assert) GtInt(min, got int, msgContext ...interface{})
- func (a *Assert) LtInt(max, got int, msgContext ...interface{})
- func (a *Assert) Nil(v interface{}, msgContext ...interface{})
- func (a *Assert) Not(ok bool, msgContext ...interface{})
- func (a *Assert) NotNil(v interface{}, msgContext ...interface{})
- func (a *Assert) NotZero(v interface{}, msgContext ...interface{})
- func (a *Assert) OK(ok bool, msgContext ...interface{})
- func (a Assert) SkipIfErr(err error)
- func (a *Assert) Zero(v interface{}, msgContext ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assert ¶
Assert is a helper struct for testing assersion
func (*Assert) EqByteString ¶
EqByteString for equality assertion ([]byte string)
func (*Assert) Failure ¶
func (a *Assert) Failure(expect interface{}, got interface{}, msgContext ...interface{})
Failure fails the test with a report This function expects to be used by another assertion package, not by test code.
func (*Assert) Nil ¶
func (a *Assert) Nil(v interface{}, msgContext ...interface{})
Nil for nil assertion
func (*Assert) NotNil ¶
func (a *Assert) NotNil(v interface{}, msgContext ...interface{})
NotNil for non-nil assertion
func (*Assert) NotZero ¶
func (a *Assert) NotZero(v interface{}, msgContext ...interface{})
NotZero for non Zero assertion
Click to show internal directories.
Click to hide internal directories.