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

retain ordering of expected calls #107

Merged
merged 1 commit into from
Sep 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions gomock/callset.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,8 @@ func (cs callSet) Remove(call *Call) {
sl := methodMap[call.method]
for i, c := range sl {
if c == call {
// quick removal; we don't need to maintain call order
if len(sl) > 1 {
sl[i] = sl[len(sl)-1]
}
methodMap[call.method] = sl[:len(sl)-1]
// maintain order for remaining calls
methodMap[call.method] = append(sl[:i], sl[i+1:]...)
break
}
}
Expand Down