NotImplements asserts that an object does not implement the specified interface. assert.NotImplements(t, (*MyInterface)(nil), new(MyObject))
(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{})
| 420 | // |
| 421 | // assert.NotImplements(t, (*MyInterface)(nil), new(MyObject)) |
| 422 | func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { |
| 423 | if h, ok := t.(tHelper); ok { |
| 424 | h.Helper() |
| 425 | } |
| 426 | interfaceType := reflect.TypeOf(interfaceObject).Elem() |
| 427 | |
| 428 | if object == nil { |
| 429 | return Fail(t, fmt.Sprintf("Cannot check if nil does not implement %v", interfaceType), msgAndArgs...) |
| 430 | } |
| 431 | if reflect.TypeOf(object).Implements(interfaceType) { |
| 432 | return Fail(t, fmt.Sprintf("%T implements %v", object, interfaceType), msgAndArgs...) |
| 433 | } |
| 434 | |
| 435 | return true |
| 436 | } |
| 437 | |
| 438 | // IsType asserts that the specified objects are of the same type. |
| 439 | func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { |
searching dependent graphs…