This file contains utilities to help with unit and integration testing AssertSuccess checks that err is nil and returns true. If it's not, it will print all the args, then write the Error string, fail the test, and return false
(t *testing.T, err error, args ...any)
| 16 | // AssertSuccess checks that err is nil and returns true. |
| 17 | // If it's not, it will print all the args, then write the Error string, fail the test, and return false |
| 18 | func AssertSuccess(t *testing.T, err error, args ...any) bool { |
| 19 | if err != nil { |
| 20 | for _, arg := range args { |
| 21 | t.Log(arg) |
| 22 | } |
| 23 | t.Error(err.Error()) |
| 24 | debug.PrintStack() |
| 25 | |
| 26 | return false |
| 27 | } |
| 28 | return true |
| 29 | } |
| 30 | |
| 31 | func RequireSuccess(t *testing.T, err error, args ...any) bool { |
| 32 | if err != nil { |