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.

Calling EXPECT().MinTimes(1).MaxTimes(1) / MaxTimes(1).MinTimes(1) is confusing #331

@lukedirtwalker

Description

@lukedirtwalker

The documentation says:

If AnyTimes or MaxTimes have not been called, MinTimes sets the maximum number of calls to infinity.

But if MaxTimes is called with argument 1 the MinTimes code considers this as MaxTimes has not been called yet.
See

mock/gomock/call.go

Lines 89 to 91 in dd8d2a2

if c.maxCalls == 1 {
c.maxCalls = 1e8
}

and

mock/gomock/call.go

Lines 99 to 101 in dd8d2a2

if c.minCalls == 1 {
c.minCalls = 0
}

This is confusing and should either be fixed in the documentation or by adding a flag to check whether Min/Max-Times was called.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions