ok fails the test if an err is not nil.
(tb testing.TB, err error, args ...interface{})
| 205 | |
| 206 | // ok fails the test if an err is not nil. |
| 207 | func Ok(tb testing.TB, err error, args ...interface{}) { |
| 208 | if err != nil { |
| 209 | msg := fmt.Sprintf("%s: unexpected error: %s\n\n", caller(), err.Error()) |
| 210 | if len(args) > 0 { |
| 211 | msg = fmt.Sprintf("%s: %s "+args[0].(string), append([]interface{}{caller(), err}, args[1:]...)) + "\n\n" |
| 212 | } |
| 213 | fmt.Println(msg) |
| 214 | tb.FailNow() |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | func NotOk(tb testing.TB, err error) { |
| 219 | if err == nil { |