| 195 | } |
| 196 | |
| 197 | func isEmpty(object interface{}) bool { |
| 198 | if object == nil { |
| 199 | return true |
| 200 | } |
| 201 | v := reflect.ValueOf(object) |
| 202 | switch v.Kind() { |
| 203 | case reflect.Array, reflect.Slice, reflect.Map, reflect.Chan, reflect.String: |
| 204 | return v.Len() == 0 |
| 205 | case reflect.Ptr, reflect.Interface: |
| 206 | if v.IsNil() { |
| 207 | return true |
| 208 | } |
| 209 | return isEmpty(v.Elem().Interface()) |
| 210 | } |
| 211 | // numbers and structs are never considered empty here |
| 212 | return false |
| 213 | } |
| 214 | |
| 215 | func (a nonfatal) Len(t *testing.T, object interface{}, length int, msgAndArgs ...interface{}) bool { |
| 216 | t.Helper() |