Skip to content

Commit

Permalink
Add regression test for polyfloyd#48
Browse files Browse the repository at this point in the history
  • Loading branch information
triarius committed Aug 2, 2023
1 parent 41edee2 commit a5751ed
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions errorlint/testdata/src/issues/github-48.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package issues

// Regression test for: https://github.com/polyfloyd/go-errorlint/issues/48

type AssertError struct {
reason string
}

func (e *AssertError) Error() string {
return e.reason
}

func (e *AssertError) Is(target error) bool {
terr, ok := target.(*AssertError)
return ok && terr.reason == e.reason
}

type SwitchError struct {
reason string
}

func (e *SwitchError) Error() string {
return e.reason
}

func (e *SwitchError) Is(target error) bool {
switch terr := target.(type) {
case *SwitchError:
return terr.reason == e.reason
default:
return false
}
}

0 comments on commit a5751ed

Please sign in to comment.