NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either a slice or a channel with len == 0. if assert.NotEmpty(t, obj) { assert.Equal(t, "two", obj[1]) }
(t TestingT, object interface{}, msgAndArgs ...interface{})
| 765 | // assert.Equal(t, "two", obj[1]) |
| 766 | // } |
| 767 | func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { |
| 768 | pass := !isEmpty(object) |
| 769 | if !pass { |
| 770 | if h, ok := t.(tHelper); ok { |
| 771 | h.Helper() |
| 772 | } |
| 773 | Fail(t, fmt.Sprintf("Should NOT be empty, but was %v", object), msgAndArgs...) |
| 774 | } |
| 775 | |
| 776 | return pass |
| 777 | |
| 778 | } |
| 779 | |
| 780 | // getLen tries to get the length of an object. |
| 781 | // It returns (0, false) if impossible. |
searching dependent graphs…