MCPcopy Create free account
hub / github.com/stretchr/testify / IsType

Function IsType

assert/assertions.go:441–451  ·  view source on GitHub ↗

IsType asserts that the specified objects are of the same type.

(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

439
440// IsType asserts that the specified objects are of the same type.
441func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {
442 if h, ok := t.(tHelper); ok {
443 h.Helper()
444 }
445
446 if !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) {
447 return Fail(t, fmt.Sprintf("Object expected to be of type %v, but was %v", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...)
448 }
449
450 return true
451}
452
453// Equal asserts that two objects are equal.
454//

Callers 5

IsTypeFunction · 0.92
IsTypefFunction · 0.70
TestIsTypeFunction · 0.70
InEpsilonSliceFunction · 0.70
IsTypeMethod · 0.70

Calls 3

ObjectsAreEqualFunction · 0.85
FailFunction · 0.70
HelperMethod · 0.65

Tested by 1

TestIsTypeFunction · 0.56