testutil: don't panic on AssertNil on non-nil errors

This commit is contained in:
Anthony Romano 2017-08-23 14:22:08 -07:00 committed by Gyu-Ho Lee
parent 877d0ce469
commit 1fc300ecbd

View File

@ -54,5 +54,9 @@ func AssertFalse(t *testing.T, v bool, msg ...string) {
}
func isNil(v interface{}) bool {
return v == nil || reflect.ValueOf(v).IsNil()
if v == nil {
return true
}
rv := reflect.ValueOf(v)
return rv.Kind() != reflect.Struct && rv.IsNil()
}