Neatened up generated code

This commit is contained in:
Mat Ryer 2017-07-04 17:48:32 -06:00
parent ac5bfca30c
commit 78083d2e52

View File

@ -216,7 +216,7 @@ var moqTemplate = `package {{.PackageName}}
// // make and configure a mocked {{.InterfaceName}}
// mocked{{.InterfaceName}} := &{{.InterfaceName}}Mock{ {{ range .Methods }}
// {{.Name}}Func: func({{ .Arglist }}) {{.ReturnArglist}} {
// panic("TODO: mock out the {{.Name}} function")
// panic("TODO: mock out the {{.Name}} method")
// },{{- end }}
// }
//
@ -225,7 +225,7 @@ var moqTemplate = `package {{.PackageName}}
// }
type {{.InterfaceName}}Mock struct {
{{- range .Methods }}
// {{.Name}}Func mocks the {{.Name}} function.
// {{.Name}}Func mocks the {{.Name}} method.
{{.Name}}Func func({{ .Arglist }}) {{.ReturnArglist}}
{{- end }}
}
@ -235,11 +235,11 @@ func (mock *{{$obj.InterfaceName}}Mock) {{.Name}}({{.Arglist}}) {{.ReturnArglist
if mock.{{.Name}}Func == nil {
panic("moq: {{$obj.InterfaceName}}Mock.{{.Name}}Func is nil but was just called")
}
{{ if .ReturnArglist }}
{{- if .ReturnArglist }}
return mock.{{.Name}}Func({{.ArgCallList}})
{{ else }}
{{- else }}
mock.{{.Name}}Func({{.ArgCallList}})
{{ end }}
{{- end }}
}
{{ end -}}
{{ end -}}`