Skip to content

NotImplements #1065

@talglobus

Description

@talglobus

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions