Skip to content

mock: document Call.Times behavior when called with zero - #1948

Open
lazerg wants to merge 1 commit into
stretchr:masterfrom
lazerg:fix/issue-1947-times-zero-doc
Open

mock: document Call.Times behavior when called with zero#1948
lazerg wants to merge 1 commit into
stretchr:masterfrom
lazerg:fix/issue-1947-times-zero-doc

Conversation

@lazerg

@lazerg lazerg commented Aug 31, 2026

Copy link
Copy Markdown

Summary

Document what Call.Times(0) does.

Changes

  • Extend the Call.Times doc comment: i=0 resets the call to the default behavior of returning at least once, and omitting Mock.On is how you expect no calls at all.

Motivation

The doc comment only described the i>0 case, so Times(0) looked like a way to expect zero calls. It isn't, and a user hit that in #1855. Wording follows @brackendawson's suggestion on the issue.

Related issues

Closes #1947

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 this pull request may close these issues.

mock.Call.Time documentation incomplete

1 participant