handle the trailing space in snippets

Этот коммит содержится в:
gedi 2016-09-25 14:02:53 +03:00
родитель dcc654c5fb
коммит a4b5349b94

8
fmt.go
Просмотреть файл

@ -31,9 +31,8 @@ var undefinedSnippetsTpl = template.Must(template.New("snippets").Funcs(snippetH
return godog.ErrPending return godog.ErrPending
} }
{{end}}func FeatureContext(s *godog.Suite) { {{- range . }} {{end}}func FeatureContext(s *godog.Suite) { {{ range . }}
s.Step({{ backticked .Expr }}, {{ .Method }}) s.Step({{ backticked .Expr }}, {{ .Method }}){{end}}
{{- end}}
} }
`)) `))
@ -413,7 +412,8 @@ func (f *basefmt) snippets() string {
if err := undefinedSnippetsTpl.Execute(&buf, snips); err != nil { if err := undefinedSnippetsTpl.Execute(&buf, snips); err != nil {
panic(err) panic(err)
} }
return buf.String() // there may be trailing spaces
return strings.Replace(buf.String(), " \n", "\n", -1)
} }
func (f *basefmt) isLastStep(s *gherkin.Step) bool { func (f *basefmt) isLastStep(s *gherkin.Step) bool {