Skip to content

mock: report the remaining expected call count - #1991

Draft
hafizahmedzia wants to merge 1 commit into
stretchr:masterfrom
hafizahmedzia:oss-oct15-missing-call-count
Draft

hafizahmedzia wants to merge 1 commit into
stretchr:masterfrom
hafizahmedzia:oss-oct15-missing-call-count

Conversation

@hafizahmedzia

Copy link
Copy Markdown

Summary

Correct the missing-call count in Mock.AssertExpectations diagnostics. With Times(5) and one call made, the message now asks for four more calls.

Changes

Count remaining required calls separately from unmet expectations. Matching, locking, Maybe, Times, and NotBefore behavior are unchanged. Add focused repeatability and mixed-expectation regressions.

Motivation

The current diagnostic counts unmet expectation objects while describing that number as missing calls. This addresses the message without duplicating expectation bookkeeping as in the closed #1468.

Related issues

Refs #1383. Thanks to Ullaakut for the earlier investigation and the maintainers for the narrower direction.

Validation

On Linux, new regressions failed on base 87a7b9d and passed with this patch. Go 1.27.2 full race suite and Go 1.17.13 full suite passed; vet, formatting, whitespace, and generation no-drift comparisons were clean. The full historical/stable-oldstable CI matrix and native macOS/Windows were not run.

Prepared with OpenAI Codex assistance; the results above are scoped executions from the retained validation packet.

Report missing calls separately from unmet expectations without changing expectation bookkeeping. Add regression coverage for repeatability, optional calls, and existing behavior.

Refs stretchr#1383. Prepared from the reviewed October 15 patch with AI assistance.
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.

1 participant