Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

proposal: Add a new matcher which return true if it matches one of given value #590

Open
@MakDon

Description

@MakDon

Requested feature

A In([]T) matcher which returns true if it matches one of the given value.

For Example:

m.
    EXPECT().
    CheckIsFruit(gomock.In([]string{"Apple", "Banana", "Cherry"})).
    Return(True)

Why the feature is needed

With this matcher, we could cover the scenes where the args could be one of the options and make the EXPECT() assertion more reusable.

Proposed solution

When Matches() is called, it generates Eq Matchers from the given slice, and check eqMatcher.Matches() one by one.
I've tried to make a PR. See #582

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions