gotests
gotests copied to clipboard
No need for "type args struct" if function takes a single-argument
e.g.
func Test_clonePod(t *testing.T) {
type args struct {
pod *corev1.Pod
}
tests := []struct {
name string
args args
want *corev1.Pod
wantErr bool
}{
// TODO: Add test cases.
}
...
}
In the code above, instead of generating type args struct { ...}, it's sufficient to just specify args field in anonymous struct as *corev1.Pod and not generate an additional type. This should help create simpler and more readable tests.
Sounds reasonable. Feel free to make a pull request.