diff options
Diffstat (limited to 'internal/pkg/pkg_test.go')
| -rw-r--r-- | internal/pkg/pkg_test.go | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go index a6964798..39218d96 100644 --- a/internal/pkg/pkg_test.go +++ b/internal/pkg/pkg_test.go @@ -11,7 +11,6 @@ import ( "io" "io/fs" "log" - "maps" "net/http" "os" "path/filepath" @@ -1979,6 +1978,22 @@ func TestInputError(t *testing.T) { stub.UniqueError(0xbad09), stub.UniqueError(0xbad0f), }}, + + {"dedup", pkg.InputError{ + makeIdent(0xff, 9): stub.UniqueError(0xbad09), + makeIdent(0xff, 9): stub.UniqueError(0xbad09), + makeIdent(0xff, 9): stub.UniqueError(0xbad09), + makeIdent(0xff, 0): stub.UniqueError(0xbad00), + makeIdent(0xff, 0): stub.UniqueError(0xbad00), + makeIdent(0xff, 1): stub.UniqueError(0xbad01), + }, `errors curing inputs: + _wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765184 injected by the test suite + _wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765185 injected by the test suite + _wkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765193 injected by the test suite`, []error{ + stub.UniqueError(0xbad00), + stub.UniqueError(0xbad01), + stub.UniqueError(0xbad09), + }}, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { @@ -1988,19 +2003,7 @@ func TestInputError(t *testing.T) { t.Errorf("Error:\n%s\nwant\n%s", got, tc.want) } - unwrap, unwrapM := tc.err.Unwrap(), make(map[error]struct{}) - for _, a := range unwrap { - unwrapM[a] = struct{}{} - } - - wantUnwrapM := make(map[error]struct{}) - for _, a := range tc.unwrap { - wantUnwrapM[a] = struct{}{} - } - - if len(unwrap) != len(unwrapM) || - len(tc.unwrap) != len(wantUnwrapM) || - !maps.Equal(unwrapM, wantUnwrapM) { + if unwrap := tc.err.Unwrap(); !reflect.DeepEqual(unwrap, tc.unwrap) { t.Errorf("Unwrap: %#v, want %#v", unwrap, tc.unwrap) } }) |
