removes sorting feature files, accepts them by given order, closes #78

Этот коммит содержится в:
gedi 2017-04-27 15:17:53 +03:00
родитель 0b640526cf
коммит 169d617b26
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 56604CDCCC201556
3 изменённых файлов: 14 добавлений и 12 удалений

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

@ -3,6 +3,9 @@
**2017-04-27**
- added an option to randomize scenario execution order, so we could
ensure that scenarios do not depend on global state.
- godog was manually sorting feature files by name. Now it just runs them
in given order, you may sort them anyway you like. For example `godog
$(find . -name '*.feature' | sort)`
**2016-10-30** - **v0.6.0**
- added experimental **events** format, this might be used for unified

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

@ -9,7 +9,6 @@ import (
"path/filepath"
"reflect"
"regexp"
"sort"
"strconv"
"strings"
"unicode/utf8"
@ -467,16 +466,9 @@ func parseFeatures(filter string, paths []string) (features []*feature, err erro
return features, err
}
}
sort.Sort(featuresSortedByPath(features))
return
}
type featuresSortedByPath []*feature
func (s featuresSortedByPath) Len() int { return len(s) }
func (s featuresSortedByPath) Less(i, j int) bool { return s[i].Path < s[j].Path }
func (s featuresSortedByPath) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func applyTagFilter(tags string, ft *gherkin.Feature) {
if len(tags) == 0 {
return

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

@ -297,12 +297,19 @@ func (s *suiteContext) iShouldHaveNumFeatureFiles(num int, files *gherkin.DocStr
return fmt.Errorf("expected %d feature paths to be parsed, but have %d", len(expected), len(actual))
}
for i := 0; i < len(expected); i++ {
var matched bool
split := strings.Split(expected[i], "/")
exp := filepath.Join(split...)
split = strings.Split(actual[i], "/")
act := filepath.Join(split...)
if exp != act {
return fmt.Errorf(`expected feature path "%s" at position: %d, does not match actual "%s"`, exp, i, act)
for j := 0; j < len(actual); j++ {
split = strings.Split(actual[j], "/")
act := filepath.Join(split...)
if exp == act {
matched = true
break
}
}
if !matched {
return fmt.Errorf(`expected feature path "%s" at position: %d, was not parsed, actual are %+v`, exp, i, actual)
}
}
return nil