From d38a4ae585bb5061b264c667d65f2adf922934a7 Mon Sep 17 00:00:00 2001 From: Grégoire Duchêne Date: Sun, 12 Jun 2022 22:40:40 +0100 Subject: Add SPDX tags --- net.go | 3 +++ net_test.go | 3 +++ testing.go | 9 +++++++-- util.go | 3 +++ util_test.go | 3 +++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/net.go b/net.go index bf2081b..040fe66 100644 --- a/net.go +++ b/net.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: © 2022 Grégoire Duchêne +// 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 +// SPDX-License-Identifier: ISC + package core_test import ( diff --git a/testing.go b/testing.go index e18b4e9..ba22828 100644 --- a/testing.go +++ b/testing.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: © 2022 Grégoire Duchêne +// 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 } diff --git a/util.go b/util.go index 34cf28b..d6f1985 100644 --- a/util.go +++ b/util.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: © 2022 Grégoire Duchêne +// 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 +// SPDX-License-Identifier: ISC + package core_test import ( -- cgit v1.2.3-70-g09d2