Condition uses a Comparison to assert a complex condition.
(t TestingT, comp Comparison, msgAndArgs ...interface{})
| 1262 | |
| 1263 | // Condition uses a Comparison to assert a complex condition. |
| 1264 | func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool { |
| 1265 | if h, ok := t.(tHelper); ok { |
| 1266 | h.Helper() |
| 1267 | } |
| 1268 | result := comp() |
| 1269 | if !result { |
| 1270 | Fail(t, "Condition failed!", msgAndArgs...) |
| 1271 | } |
| 1272 | return result |
| 1273 | } |
| 1274 | |
| 1275 | // PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics |
| 1276 | // methods, and represents a simple func that takes no arguments, and returns nothing. |