MCPcopy Create free account
hub / github.com/stretchr/objx / Len

Method Len

std_assert_test.go:229–240  ·  view source on GitHub ↗
(t *testing.T, object interface{}, length int, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

227}
228
229func (a fatal) Len(t *testing.T, object interface{}, length int, msgAndArgs ...interface{}) {
230 t.Helper()
231 v := reflect.ValueOf(object)
232 switch v.Kind() {
233 case reflect.Array, reflect.Slice, reflect.Map, reflect.Chan, reflect.String:
234 if v.Len() != length {
235 a.fail(t, "unexpected length, expected %d got %d", length, v.Len())
236 }
237 default:
238 a.fail(t, "Len not supported for kind %s", v.Kind())
239 }
240}

Callers 4

isEmptyFunction · 0.45
LenMethod · 0.45
TestJSONTopLevelSliceFunction · 0.45
interSliceFunction · 0.45

Calls 1

failMethod · 0.95

Tested by

no test coverage detected