diff --git a/features/snippets.feature b/features/snippets.feature index 2c5341c..43b5eec 100644 --- a/features/snippets.feature +++ b/features/snippets.feature @@ -53,16 +53,16 @@ Feature: undefined step snippets func iSendRequestToWith(arg1, arg2 string, arg3 *godog.Table) { } - func theResponseBodyShouldBe(arg1 *godog.DocString) { + func theResponseCodeShouldBeAndHeaderShouldBe(arg1 int, arg2, arg3 string) { } - func theResponseCodeShouldBeAndHeaderShouldBe(arg1 int, arg2, arg3 string) { + func theResponseBodyShouldBe(arg1 *godog.DocString) { } func InitializeScenario(ctx *godog.ScenarioContext) { 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 body should be:$`, theResponseBodyShouldBe) } """ @@ -107,15 +107,15 @@ Feature: undefined step snippets When I run feature suite And the undefined step snippets should be: """ - func iAddTheToTheBasket(arg1 string) { - } - func thereIsAWhichCosts(arg1 string, arg2 int) { } + func iAddTheToTheBasket(arg1 string) { + } + func InitializeScenario(ctx *godog.ScenarioContext) { - ctx.Step(`^I add the "([^"]*)" to the basket$`, iAddTheToTheBasket) ctx.Step(`^there is a "([^"]*)", which costs £(\d+)$`, thereIsAWhichCosts) + ctx.Step(`^I add the "([^"]*)" to the basket$`, iAddTheToTheBasket) } """ @@ -131,19 +131,20 @@ Feature: undefined step snippets When I run feature suite And the undefined step snippets should be: """ - func godogs(arg1 int) { - } - func whichCosts(arg1 string, arg2 int) { } + func godogs(arg1 int) { + } + func InitializeScenario(ctx *godog.ScenarioContext) { - ctx.Step(`^(\d+) godogs$`, godogs) ctx.Step(`^"([^"]*)", which costs £(\d+)$`, whichCosts) + ctx.Step(`^(\d+) godogs$`, godogs) } """ Scenario: should generate snippets in russian + and gen'ed functions are in declaration order Given a feature "undefined.feature" file: """ # language: ru @@ -164,18 +165,18 @@ Feature: undefined step snippets """ And the undefined step snippets should be: """ - func получаетсяЕщёБолееЧтото() { - } - func чтото() { } func яДелаюЕщёЧтото() { } + func получаетсяЕщёБолееЧтото() { + } + func InitializeScenario(ctx *godog.ScenarioContext) { - ctx.Step(`^получается ещё более что-то$`, получаетсяЕщёБолееЧтото) ctx.Step(`^что-то$`, чтото) ctx.Step(`^я делаю ещё что-то$`, яДелаюЕщёЧтото) + ctx.Step(`^получается ещё более что-то$`, получаетсяЕщёБолееЧтото) } """ diff --git a/internal/formatters/fmt_base.go b/internal/formatters/fmt_base.go index 85c813b..2e21de7 100644 --- a/internal/formatters/fmt_base.go +++ b/internal/formatters/fmt_base.go @@ -5,7 +5,6 @@ import ( "fmt" "io" "os" - "sort" "strconv" "strings" "sync" @@ -253,8 +252,6 @@ func (f *Base) Snippets() string { } } - sort.Sort(snippetSortByMethod(snips)) - var buf bytes.Buffer if err := undefinedSnippetsTpl.Execute(&buf, snips); err != nil { panic(err)