gotests
gotests copied to clipboard
Generated tests for main func have syntax err
undefined: tt in tt.name.
func Test_main(t *testing.T) {
tests := []struct {
name string
}{
// TODO: Add test cases.
}
for range tests {
t.Run(tt.name, func(t *testing.T) { // <-- tt is undefined
main()
})
}
}
I was bitten by this as well. Cause seems to be the template excluding loop index/value in the case of functions that take no arguments and return no values. function.tmpl, line 44
@cweill, can we just remove that check? If that's ok with you I will fix and send a PR.
Hey yeah, sure thing. Send a PR and I'll approve.
Thank you @cweill. Please review.