diff options
| -rw-r--r-- | net.go | 3 | ||||
| -rw-r--r-- | net_test.go | 3 | ||||
| -rw-r--r-- | testing.go | 9 | ||||
| -rw-r--r-- | util.go | 3 | ||||
| -rw-r--r-- | util_test.go | 3 |
5 files changed, 19 insertions, 2 deletions
@@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: © 2022 Grégoire Duchêne <gduchene@awhk.org> +// SPDX-License-Identifier: ISC + package core import ( diff --git a/net_test.go b/net_test.go index 3c01a15..487dd58 100644 --- a/net_test.go +++ b/net_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: © 2022 Grégoire Duchêne <gduchene@awhk.org> +// SPDX-License-Identifier: ISC + package core_test import ( @@ -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 } @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: © 2022 Grégoire Duchêne <gduchene@awhk.org> +// SPDX-License-Identifier: ISC + package core // Must panics if err is not nil. It returns val otherwise. diff --git a/util_test.go b/util_test.go index 65cc3bc..783c86b 100644 --- a/util_test.go +++ b/util_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: © 2022 Grégoire Duchêne <gduchene@awhk.org> +// SPDX-License-Identifier: ISC + package core_test import ( |
