mirror of https://github.com/stretchr/testify.git
Issue #469 fix
reflect.Value.Len() can cover more types, per godoc: > Len returns v's length. It panics if v's Kind is not Array, Chan, Map, Slice, or String.pull/459/merge
parent
05e8a0eda3
commit
890a5c3458
|
@ -449,9 +449,7 @@ func isEmpty(object interface{}) bool {
|
||||||
objValue := reflect.ValueOf(object)
|
objValue := reflect.ValueOf(object)
|
||||||
|
|
||||||
switch objValue.Kind() {
|
switch objValue.Kind() {
|
||||||
case reflect.Map:
|
case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice, reflect.String:
|
||||||
fallthrough
|
|
||||||
case reflect.Slice, reflect.Chan:
|
|
||||||
{
|
{
|
||||||
return (objValue.Len() == 0)
|
return (objValue.Len() == 0)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue