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 --- testing.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'testing.go') 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 } -- cgit v1.2.3-70-g09d2