Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected change of behaviour in MatchError() matcher #374

Closed
blgm opened this issue Dec 19, 2019 · 0 comments · Fixed by #375
Closed

Unexpected change of behaviour in MatchError() matcher #374

blgm opened this issue Dec 19, 2019 · 0 comments · Fixed by #375

Comments

@blgm
Copy link
Collaborator

blgm commented Dec 19, 2019

In Gomega 1.7.1 the following used to pass:

type CustomError struct {}

func (c CustomError) Error() string {
	return "an error"
}

c := CustomError{}
Expect(&c).To(MatchError(&c))

With Gomega 1.8.0, the test above fails with:

      Expected
          <*matchers_test.CustomError | 0x19c1858>: {}
      to match error
          <*matchers_test.CustomError | 0x19c1858>: {}

The reason is that when the extensions for testing wrapped errors was added in #359, we assumed that we would always pass error values rather than pointers. This is not always the case, so some consumers of Gomega may be broken.

blgm added a commit that referenced this issue Dec 19, 2019
Resolves #374

Co-authored-by: Marcela Campo <mcampo@pivotal.io>
Co-authored-by: George Blue <gblue@pivotal.io>
blgm added a commit that referenced this issue Dec 19, 2019
Resolves #374

Co-authored-by: Marcela Campo <mcampo@pivotal.io>
Co-authored-by: George Blue <gblue@pivotal.io>
Co-authored-by: David Ansari <dansari@pivotal.io>
@blgm blgm closed this as completed in #375 Dec 19, 2019
blgm added a commit that referenced this issue Dec 19, 2019
Resolves #374

Co-authored-by: Marcela Campo <mcampo@pivotal.io>
Co-authored-by: George Blue <gblue@pivotal.io>
Co-authored-by: David Ansari <dansari@pivotal.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant