Documentation ¶
Overview ¶
package assert provides convenience assert methods to complement the built in go testing library. It's intended to add onto standard Go tests. Example usage:
func TestSomething(t *testing.T) { i, err := doSomething() assert.NoErr(err) assert.Equal(i, 123, "returned integer") }
Index ¶
- func Equal(t *testing.T, actual, expected interface{}, noun string)
- func Err(t *testing.T, expected error, actual error)
- func ExistsErr(t *testing.T, err error, noun string)
- func False(t *testing.T, b bool, fmtStr string, vals ...interface{})
- func Nil(t *testing.T, i interface{}, noun string)
- func NoErr(t *testing.T, e error)
- func NotNil(t *testing.T, i interface{}, noun string)
- func True(t *testing.T, b bool, fmtStr string, vals ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Equal ¶
Equal ensures that the actual value returned from a test was equal to an expected. it uses reflect.DeepEqual to do so. name is used to describe the values being compared. it's used in the error string if actual != expected.
func Err ¶
Err calls t.Fatalf if expected is not equal to actual. it uses reflect.DeepEqual to determine if the errors are equal
func ExistsErr ¶
if err == nil, ExistsErr calls t.Fatalf explaining that the error described by noun was nil when it shouldn't have been
func Nil ¶
Nil uses reflect.DeepEqual(i, nil) to determine if i is nil. if it's not, Nil calls t.Fatalf explaining that the noun i is not nil when it should have been
Types ¶
This section is empty.