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

Commit

Permalink
When searches for a matching call, use most recently expected call.
Browse files Browse the repository at this point in the history
  • Loading branch information
yanbo committed Jul 19, 2018
1 parent 22bbf0d commit fc43024
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gomock/callset.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ func (cs callSet) FindMatch(receiver interface{}, method string, args []interfac
// Search through the expected calls.
expected := cs.expected[key]
var callsErrors bytes.Buffer
for _, call := range expected {
err := call.matches(args)
for i := len(expected) - 1; i >= 0; i-- {
err := expected[i].matches(args)
if err != nil {
fmt.Fprintf(&callsErrors, "\n%v", err)
} else {
return call, nil
return expected[i], nil
}
}

Expand Down

0 comments on commit fc43024

Please sign in to comment.