Closed AndrewRPorter closed 3 weeks ago
Ah, never mind my last comment, I was also able to remove the draft status.
Okay, tests show this doesn't work for variadic arguments. I recommend to stick with changing from comparison > 0
to != 0
, assuming it will satisfy CodeQL. This will not change the logic and therefore not break the tests.
Sadly it doesn't look like changing the check to != 0
fixes the CodeQL warnings.
Instead, I just added a check for non variadic arguments.
This change generates verification methods like:
func (c *MockDisplay_ChanParams_OngoingVerification) GetAllCapturedArguments() (_param0 []<-chan string, _param1 []chan<- error) {
_params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(_params) > 0 {
if 0 < len(_params) {
_param0 = make([]<-chan string, len(c.methodInvocations))
for u, param := range _params[0] {
_param0[u] = param.(<-chan string)
}
}
if 1 < len(_params) {
_param1 = make([]chan<- error, len(c.methodInvocations))
for u, param := range _params[1] {
_param1[u] = param.(chan<- error)
}
}
}
return
}
Merged and cut a new release 4.1.0 with your changes. Thank you very much for your contribution @AndrewRPorter.
v4 commits do not exist in
develop
branch, so PR is created againstmain
.Pull Request Changes
Closes
https://github.com/petergtz/pegomock/issues/125