Генерённые функции выдаются в порядке следования в сценарии

Этот коммит содержится в:
Softonik 2022-11-25 21:22:06 +03:00 коммит произвёл Nikolay Kopitonenko
родитель 8dbd7d2175
коммит a21b046e35
2 изменённых файлов: 16 добавлений и 18 удалений

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

@ -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(`^получается ещё более что-то$`, получаетсяЕщёБолееЧтото)
}
"""

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

@ -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)