feat: generate simpler snippets that use *godog.DocString and *godog.Table

Этот коммит содержится в:
Hiram Chirino 2021-03-09 12:36:57 -05:00 коммит произвёл Fredrik Lönnblad
родитель 2b6c9dc82e
коммит 5ac22c454c
2 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -44,11 +44,19 @@ Feature: undefined step snippets
| col1 | val1 | | col1 | val1 |
| col2 | val2 | | col2 | val2 |
Then the response code should be 200 and header "X-Powered-By" should be "godog" Then the response code should be 200 and header "X-Powered-By" should be "godog"
And the response body should be:
\"\"\"
Hello World
\"\"\"
""" """
When I run feature suite When I run feature suite
Then the undefined step snippets should be: Then the undefined step snippets should be:
""" """
func iSendRequestToWith(arg1, arg2 string, arg3 *messages.PickleStepArgument_PickleTable) error { func iSendRequestToWith(arg1, arg2 string, arg3 *godog.Table) error {
return godog.ErrPending
}
func theResponseBodyShouldBe(arg1 *godog.DocString) error {
return godog.ErrPending return godog.ErrPending
} }
@ -58,6 +66,7 @@ Feature: undefined step snippets
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {
ctx.Step(`^I send "([^"]*)" request to "([^"]*)" with:$`, iSendRequestToWith) ctx.Step(`^I send "([^"]*)" request to "([^"]*)" with:$`, iSendRequestToWith)
ctx.Step(`^the response body should be:$`, theResponseBodyShouldBe)
ctx.Step(`^the response code should be (\d+) and header "([^"]*)" should be "([^"]*)"$`, theResponseCodeShouldBeAndHeaderShouldBe) ctx.Step(`^the response code should be (\d+) and header "([^"]*)" should be "([^"]*)"$`, theResponseCodeShouldBeAndHeaderShouldBe)
} }
""" """

Просмотреть файл

@ -70,11 +70,11 @@ func (s undefinedSnippet) Args() (ret string) {
if s.argument != nil { if s.argument != nil {
if s.argument.GetDocString() != nil { if s.argument.GetDocString() != nil {
args = append(args, "*messages.PickleStepArgument_PickleDocString") args = append(args, "*godog.DocString")
} }
if s.argument.GetDataTable() != nil { if s.argument.GetDataTable() != nil {
args = append(args, "*messages.PickleStepArgument_PickleTable") args = append(args, "*godog.Table")
} }
} }