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

NotImplements #1065

Closed
talglobus opened this issue Apr 2, 2021 · 1 comment · Fixed by #1385
Closed

NotImplements #1065

talglobus opened this issue Apr 2, 2021 · 1 comment · Fixed by #1385

Comments

@talglobus
Copy link

A useful pattern is to have a function take a thing that doesn't implement an interface and return anotherThing that does. These glue functions work really well to connect different parts of an application, and create a useful abstraction across interfaces.

The way I test these functions is with assert.Implements(t, interface, anotherThing) on the result of the function, and _, ok := thing.(interface); assert.False(ok) on the input for good measure.

It would be oh so convenient if there were an assert.NotImplements(t, interface, thing) I could run instead, and it would be fairly trivial to add to the API as it stands. If this isn't the kind of change that's likely to happen, is there a more semantically reasonable way of doing this?

@mitar
Copy link

mitar commented Nov 23, 2021

i would also love to see NotImplements.

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.

2 participants