Этот коммит содержится в:
gedi 2017-05-24 16:04:43 +03:00
родитель b4a371731c
коммит b10470da31
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 56604CDCCC201556
2 изменённых файлов: 27 добавлений и 1 удалений

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

@ -118,3 +118,29 @@ Feature: undefined step snippets
s.Step(`^I add the "([^"]*)" to the basket$`, iAddTheToTheBasket)
}
"""
Scenario: should handle arguments in the beggining or end of the step
Given a feature "undefined.feature" file:
"""
Feature: undefined
Scenario: add item to basket
Given "Sith Lord Lightsaber", which costs £5
And 12 godogs
"""
When I run feature suite
And the undefined step snippets should be:
"""
func whichCosts(arg1 string, arg2 int) error {
return godog.ErrPending
}
func godogs(arg1 int) error {
return godog.ErrPending
}
func FeatureContext(s *godog.Suite) {
s.Step(`^"([^"]*)", which costs £(\d+)$`, whichCosts)
s.Step(`^(\d+) godogs$`, godogs)
}
"""

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

@ -403,7 +403,7 @@ func (f *basefmt) snippets() string {
name := snippetNumbers.ReplaceAllString(step, " ")
name = snippetExprQuoted.ReplaceAllString(name, " ")
name = snippetMethodName.ReplaceAllString(name, "")
name = strings.TrimSpace(snippetMethodName.ReplaceAllString(name, ""))
var words []string
for i, w := range strings.Split(name, " ") {
if i != 0 {