xhd2015 / xgo

All-in-one go testing library
MIT License
289 stars 16 forks source link

Discussion: not able to setup interceptor on inherited Method #209

Open xhd2015 opened 1 week ago

xhd2015 commented 1 week ago

Given the following code:


type Base struct {
}

func (c Base) Validate(){}

type Sub struct {
    Base
}

Setting up interceptor Sub.Validate would fail with xgo 1.0.40:

func TestValidate(t *testing.T){
    trap.AddFuncInterceptor(Sub.Validate, ....)
}

The workaround:

func TestValidate(t *testing.T){
    trap.AddFuncInterceptor(Base.Validate, ....)
}