Skip to content

Commit

Permalink
test: regression test for #50
Browse files Browse the repository at this point in the history
  • Loading branch information
triarius authored and polyfloyd committed Aug 20, 2023
1 parent 40fde69 commit d2842c5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions errorlint/testdata/src/issues/issue-50.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/50

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 d2842c5

Please sign in to comment.