Repository navigation
mock: report the remaining expected call count - #1991
Draft
hafizahmedzia wants to merge 1 commit into
Draft
hafizahmedzia wants to merge 1 commit into
hafizahmedzia wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Correct the missing-call count in
Mock.AssertExpectationsdiagnostics. WithTimes(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, andNotBeforebehavior 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
87a7b9dand 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.