Open jeandeducla opened 1 month ago
from locally debugging, I have the impression the call to Diff
in Unset
is not correctly comparing the arguments here; it does not cover the case of actual
being a anythingOfTypeArgument
. Locally I did that:
switch expected := expected.(type) {
case anythingOfTypeArgument:
// type checking
~ switch actual := actual.(type) {
~ case anythingOfTypeArgument:
~ if string(actual) != string(expected) {
~ differences++
+ }
+ default:
+ if reflect.TypeOf(actual).Name() != string(expected) && reflect.TypeOf(actual).String() != string(expected) {
+ // not match
+ differences++
+ output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, expected, reflect.TypeOf(actual).Name(), actu
+ }
}
which does the trick.
Happy to make a PR
Description
When you use
mock.AnythingOfType("foo")
inOn(...)
and then try to callUnset()
on the resulting call, the code panics.Step To Reproduce
Here is a simple snippet that reproduces the issue:
Expected behavior
I expect to be able to call
Unset()
on acall
that has been mocked withmock.AnythingOfType
(or did I miss something on how to use the API? Happy to get feedback here :-))Actual behavior
When calling
Unset()
on acall
that has been mocked withmock.AnythingOfType
, it panics.