Open alexykot opened 2 years ago
Thanks for the issue, I will take a look!
Bug still persists, but I used a workaround with a custom matcher
test.mock.EXPECT().DoSomething(AnyOfStrings([]string{"foo","bar})).Return(&Response{})
type AnyOfStrings ([]string)
func (m *AnyOfStrings) Matches(x interface{}) bool {
for _, v := range *m {
if v == x.(string) {
return true
}
}
return false
}
func (m *AnyOfStrings) String() string {
return fmt.Sprintf("is one of %v", *m)
}
Any updates on the issue?
FYI Same problem were
Actual behaviour When I have
EXPECT
set for two calls to the same method with different parameters - the order ofEXPECT
definitions enforces the order of the actual calls.I.e. when having these expectations defined:
and code under test defined as
Just changing the order of definitions of calls expected with no other changes, i.e. making it
makes the test fail.
Expected behavior As per documentation:
So no order should be enforced as long as the actual calls match any of the defined expectations.
Additional Information