diff options
Diffstat (limited to 'sdk/testing.go')
| -rw-r--r-- | sdk/testing.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sdk/testing.go b/sdk/testing.go index 9e272019e..14a397c68 100644 --- a/sdk/testing.go +++ b/sdk/testing.go @@ -173,6 +173,15 @@ func (h *TestHelper) AssertStringEquals(message string, expected string, actual } } +func (h *TestHelper) AssertErrorMessageEquals(message string, expected string, actual error) { + h.t.Helper() + if actual == nil { + h.t.Errorf("Expected error but was nil") + } else if actual.Error() != expected { + h.t.Errorf("%s: expected %s, actual %s", message, expected, actual.Error()) + } +} + func (h *TestHelper) AssertTrimmedStringEquals(message string, expected string, actual string) { h.t.Helper() h.AssertStringEquals(message, strings.TrimSpace(expected), strings.TrimSpace(actual)) |