gomock caller.SetArg recognizes variadic pointer parameter as a single param
Code example
func (p *pkg) VariadicInterface(data ...interface{}) {
for i := range data {
data[i] = i
}
}
func (p *pkg) VariadicInt(data ...*int) {
for i := range data {
*data[i] = i
}
}
// Usage
var a, b, c, d int
pkgReal.VariadicInterface(&a, &b)
pkgReal.VariadicInt(&c, &d)
gomock caller.SetArg recognizes variadic pointer parameter as a single param
Code example
Expect function on Test
Output
SetArg(1, ...) called for a method with 1 args
Expected behaviour
Test passed with
a
,b
,c
, andd
match given valuePlease correct me if I use it wrong.