diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2022-06-12 22:40:40 +0100 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2022-06-12 22:40:40 +0100 |
| commit | d38a4ae585bb5061b264c667d65f2adf922934a7 (patch) | |
| tree | 3c959b63346aad8e5d61ee1a566e1bdd93e953e2 /testing.go | |
| parent | 17148b7d2981d98309f7346435f5d3e77c586ab4 (diff) | |
Add SPDX tags
Diffstat (limited to 'testing.go')
| -rw-r--r-- | testing.go | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: © 2022 Grégoire Duchêne <gduchene@awhk.org> +// SPDX-License-Identifier: ISC + package core import ( @@ -8,6 +11,8 @@ import ( "github.com/google/go-cmp/cmp" ) +// T is a wrapper around the standard testing.T. It adds a few helper +// functions, but behaves otherwise like testing.T. type T struct { *testing.T Options []cmp.Option @@ -26,13 +31,13 @@ func (t *T) AssertEqual(exp, actual any) bool { return false } -func (t *T) AssertErrorIs(err, target error) bool { +func (t *T) AssertErrorIs(target, err error) bool { t.Helper() if errors.Is(err, target) { return true } - t.Errorf("\nexpected error to be %#v, got %#v", err, target) + t.Errorf("\nexpected error chain to contain %#v, got %#v", target, err) return false } |
