True asserts that the expression is true. The expression code itself will be reported if the assertion fails. func Test(t *testing.T) { is := is.New(t) val := method() is.True(val != nil) // val should never be nil } Will output: your_test.go:123: not true: val != nil
(expr bool, args ...interface{})
| 98 | // |
| 99 | // your_test.go:123: not true: val != nil |
| 100 | func (is *I) True(expr bool, args ...interface{}) { |
| 101 | if !expr { |
| 102 | is.logf("not true: ${1}%s", is.formatArgs(args)) |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | // In asserts that item is contained within list. |
| 107 | func (is *I) In(list interface{}, item interface{}, args ...interface{}) { |