mirror of https://github.com/stretchr/testify.git
assert: simplify getLen() implementation
parent
a23f5db224
commit
7a796b8f87
|
@ -736,9 +736,7 @@ func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
|
||||||
func getLen(x interface{}) (ok bool, length int) {
|
func getLen(x interface{}) (ok bool, length int) {
|
||||||
v := reflect.ValueOf(x)
|
v := reflect.ValueOf(x)
|
||||||
defer func() {
|
defer func() {
|
||||||
if e := recover(); e != nil {
|
ok = recover() == nil
|
||||||
ok = false
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
return true, v.Len()
|
return true, v.Len()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue