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

Commit fc43024

Browse files
author
yanbo
committed
When searches for a matching call, use most recently expected call.
1 parent 22bbf0d commit fc43024

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gomock/callset.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ func (cs callSet) FindMatch(receiver interface{}, method string, args []interfac
6969
// Search through the expected calls.
7070
expected := cs.expected[key]
7171
var callsErrors bytes.Buffer
72-
for _, call := range expected {
73-
err := call.matches(args)
72+
for i := len(expected) - 1; i >= 0; i-- {
73+
err := expected[i].matches(args)
7474
if err != nil {
7575
fmt.Fprintf(&callsErrors, "\n%v", err)
7676
} else {
77-
return call, nil
77+
return expected[i], nil
7878
}
7979
}
8080

0 commit comments

Comments
 (0)