Генерённые функции ничего не возвращают

Этот коммит содержится в:
Softonik 2022-11-25 21:09:02 +03:00 коммит произвёл Nikolay Kopitonenko
родитель 6c3e2a2103
коммит 8dbd7d2175
9 изменённых файлов: 25 добавлений и 47 удалений

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

@ -295,12 +295,10 @@ Feature: pretty formatter
You can implement step definitions for undefined steps with these snippets: You can implement step definitions for undefined steps with these snippets:
func undefinedDocString(arg1 *godog.DocString) error { func undefinedDocString(arg1 *godog.DocString) {
return godog.ErrPending
} }
func undefinedTable(arg1 *godog.Table) error { func undefinedTable(arg1 *godog.Table) {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {

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

@ -20,12 +20,10 @@ Feature: undefined step snippets
""" """
And the undefined step snippets should be: And the undefined step snippets should be:
""" """
func iSendRequestTo(arg1, arg2 string) error { func iSendRequestTo(arg1, arg2 string) {
return godog.ErrPending
} }
func theResponseCodeShouldBe(arg1 int) error { func theResponseCodeShouldBe(arg1 int) {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {
@ -52,16 +50,13 @@ Feature: undefined step snippets
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 *godog.Table) error { func iSendRequestToWith(arg1, arg2 string, arg3 *godog.Table) {
return godog.ErrPending
} }
func theResponseBodyShouldBe(arg1 *godog.DocString) error { func theResponseBodyShouldBe(arg1 *godog.DocString) {
return godog.ErrPending
} }
func theResponseCodeShouldBeAndHeaderShouldBe(arg1 int, arg2, arg3 string) error { func theResponseCodeShouldBeAndHeaderShouldBe(arg1 int, arg2, arg3 string) {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {
@ -88,12 +83,10 @@ Feature: undefined step snippets
""" """
And the undefined step snippets should be: And the undefined step snippets should be:
""" """
func iPullFromGithubcom() error { func iPullFromGithubcom() {
return godog.ErrPending
} }
func theProjectShouldBeThere() error { func theProjectShouldBeThere() {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {
@ -114,12 +107,10 @@ Feature: undefined step snippets
When I run feature suite When I run feature suite
And the undefined step snippets should be: And the undefined step snippets should be:
""" """
func iAddTheToTheBasket(arg1 string) error { func iAddTheToTheBasket(arg1 string) {
return godog.ErrPending
} }
func thereIsAWhichCosts(arg1 string, arg2 int) error { func thereIsAWhichCosts(arg1 string, arg2 int) {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {
@ -140,12 +131,10 @@ Feature: undefined step snippets
When I run feature suite When I run feature suite
And the undefined step snippets should be: And the undefined step snippets should be:
""" """
func godogs(arg1 int) error { func godogs(arg1 int) {
return godog.ErrPending
} }
func whichCosts(arg1 string, arg2 int) error { func whichCosts(arg1 string, arg2 int) {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {
@ -175,16 +164,13 @@ Feature: undefined step snippets
""" """
And the undefined step snippets should be: And the undefined step snippets should be:
""" """
func получаетсяЕщёБолееЧтото() error { func получаетсяЕщёБолееЧтото() {
return godog.ErrPending
} }
func чтото() error { func чтото() {
return godog.ErrPending
} }
func яДелаюЕщёЧтото() error { func яДелаюЕщёЧтото() {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {

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

@ -229,6 +229,7 @@ func (f *Base) Snippets() string {
w = strings.Title(w) w = strings.Title(w)
case len(w) > 0: case len(w) > 0:
r := []rune(w) r := []rune(w)
// tut
w = string(unicode.ToLower(r[0])) + string(r[1:]) w = string(unicode.ToLower(r[0])) + string(r[1:])
} }
words = append(words, w) words = append(words, w)

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

@ -26,4 +26,4 @@
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarions_including_failing.feature:14","timestamp":-6795364578871} {"event":"TestStepStarted","location":"formatter-tests/features/some_scenarions_including_failing.feature:14","timestamp":-6795364578871}
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:14","timestamp":-6795364578871,"status":"skipped"} {"event":"TestStepFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:14","timestamp":-6795364578871,"status":"skipped"}
{"event":"TestCaseFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:12","timestamp":-6795364578871,"status":"undefined"} {"event":"TestCaseFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:12","timestamp":-6795364578871,"status":"undefined"}
{"event":"TestRunFinished","status":"failed","timestamp":-6795364578871,"snippets":"You can implement step definitions for undefined steps with these snippets:\n\nfunc undefined() error {\n\treturn godog.ErrPending\n}\n\nfunc InitializeScenario(ctx *godog.ScenarioContext) {\n\tctx.Step(`^undefined$`, undefined)\n}\n","memory":""} {"event":"TestRunFinished","status":"failed","timestamp":-6795364578871,"snippets":"You can implement step definitions for undefined steps with these snippets:\n\nfunc undefined() {\n}\n\nfunc InitializeScenario(ctx *godog.ScenarioContext) {\n\tctx.Step(`^undefined$`, undefined)\n}\n","memory":""}

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

@ -44,8 +44,7 @@
<yellow>You can implement step definitions for undefined steps with these snippets:</yellow> <yellow>You can implement step definitions for undefined steps with these snippets:</yellow>
<yellow> <yellow>
func undefined() error { func undefined() {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {

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

@ -28,8 +28,7 @@
<yellow>You can implement step definitions for undefined steps with these snippets:</yellow> <yellow>You can implement step definitions for undefined steps with these snippets:</yellow>
<yellow> <yellow>
func undefined() error { func undefined() {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {

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

@ -14,8 +14,7 @@
<yellow>You can implement step definitions for undefined steps with these snippets:</yellow> <yellow>You can implement step definitions for undefined steps with these snippets:</yellow>
<yellow> <yellow>
func undefined() error { func undefined() {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {

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

@ -23,8 +23,7 @@ var snippetHelperFuncs = template.FuncMap{
} }
var undefinedSnippetsTpl = template.Must(template.New("snippets").Funcs(snippetHelperFuncs).Parse(` var undefinedSnippetsTpl = template.Must(template.New("snippets").Funcs(snippetHelperFuncs).Parse(`
{{ range . }}func {{ .Method }}({{ .Args }}) error { {{ range . }}func {{ .Method }}({{ .Args }}) {
return godog.ErrPending
} }
{{end}}func InitializeScenario(ctx *godog.ScenarioContext) { {{ range . }} {{end}}func InitializeScenario(ctx *godog.ScenarioContext) { {{ range . }}

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

@ -133,16 +133,13 @@ func Test_ProgressFormatterMultistepTemplates(t *testing.T) {
You can implement step definitions for undefined steps with these snippets: You can implement step definitions for undefined steps with these snippets:
func three() error { func three() {
return godog.ErrPending
} }
func unavailableCost(arg1 string, arg2 int) error { func unavailableCost(arg1 string, arg2 int) {
return godog.ErrPending
} }
func undef() error { func undef() {
return godog.ErrPending
} }
func InitializeScenario(ctx *godog.ScenarioContext) { func InitializeScenario(ctx *godog.ScenarioContext) {