AssertionHandler takes care of formatting and reporting test Failure or Success. You can log every performed assertion, or report only failures. You can implement custom formatting, for example, provide a JSON output for ulterior processing. Usually you don't need to implement AssertionHandler; in
| 219 | // Usually you don't need to implement AssertionHandler; instead you can implement |
| 220 | // Reporter, which is much simpler, and use it with DefaultAssertionHandler. |
| 221 | type AssertionHandler interface { |
| 222 | // Invoked every time when an assertion succeeded. |
| 223 | // May ignore failure, or log it, e.g. using t.Logf(). |
| 224 | Success(*AssertionContext) |
| 225 | |
| 226 | // Invoked every time when an assertion failed. |
| 227 | // Handling depends on Failure.Severity field: |
| 228 | // - for SeverityError, reports failure to testing suite, e.g. using t.Errorf() |
| 229 | // - for SeverityLog, ignores failure, or logs it, e.g. using t.Logf() |
| 230 | Failure(*AssertionContext, *AssertionFailure) |
| 231 | } |
| 232 | |
| 233 | // DefaultAssertionHandler is default implementation for AssertionHandler. |
| 234 | // |
no outgoing calls
no test coverage detected
searching dependent graphs…