NotZero asserts that i is not the zero value for its type.
(t TestingT, i interface{}, msgAndArgs ...interface{})
| 1767 | |
| 1768 | // NotZero asserts that i is not the zero value for its type. |
| 1769 | func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { |
| 1770 | if h, ok := t.(tHelper); ok { |
| 1771 | h.Helper() |
| 1772 | } |
| 1773 | if i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { |
| 1774 | return Fail(t, fmt.Sprintf("Should not be zero, but was %v", i), msgAndArgs...) |
| 1775 | } |
| 1776 | return true |
| 1777 | } |
| 1778 | |
| 1779 | // FileExists checks whether a file exists in the given path. It also fails if |
| 1780 | // the path points to a directory or there is an error when trying to check the file. |