Error output is ambiguous for equivalent values with different types #190
Description
Line 53 in 22bbf0d
When printing output for matched errors, if the expected and actual value have different types, either a special message should be printed (ie. expected value type does not match actual value type), or simply print the type with the output.
My confusing error output:
Expected call at mytest.go:467 doesn't match the argument at index 1.
Got: 8
Want: is equal to 8
In this case, I was using a const val = 8
which is resolved to an int
. The const is used in the innards of a struct that expects an int32
(so the const is correctly casted). The const is then passed as the parameter to a method mocked by EXPECT()
that originally takes an int32
, but the mock version of the method takes an interface{}
. Therefore, in the second case, the const is never casted correctly to int32 and causes a type mismatch further down the call path.
The long story short is, it's possible for gomock to print equivalent values without type information.