removes sorting feature files, accepts them by given order, closes #78
Этот коммит содержится в:
родитель
0b640526cf
коммит
169d617b26
3 изменённых файлов: 14 добавлений и 12 удалений
|
@ -3,6 +3,9 @@
|
||||||
**2017-04-27**
|
**2017-04-27**
|
||||||
- added an option to randomize scenario execution order, so we could
|
- added an option to randomize scenario execution order, so we could
|
||||||
ensure that scenarios do not depend on global state.
|
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**
|
**2016-10-30** - **v0.6.0**
|
||||||
- added experimental **events** format, this might be used for unified
|
- added experimental **events** format, this might be used for unified
|
||||||
|
|
8
suite.go
8
suite.go
|
@ -9,7 +9,6 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
@ -467,16 +466,9 @@ func parseFeatures(filter string, paths []string) (features []*feature, err erro
|
||||||
return features, err
|
return features, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sort.Sort(featuresSortedByPath(features))
|
|
||||||
return
|
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) {
|
func applyTagFilter(tags string, ft *gherkin.Feature) {
|
||||||
if len(tags) == 0 {
|
if len(tags) == 0 {
|
||||||
return
|
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))
|
return fmt.Errorf("expected %d feature paths to be parsed, but have %d", len(expected), len(actual))
|
||||||
}
|
}
|
||||||
for i := 0; i < len(expected); i++ {
|
for i := 0; i < len(expected); i++ {
|
||||||
|
var matched bool
|
||||||
split := strings.Split(expected[i], "/")
|
split := strings.Split(expected[i], "/")
|
||||||
exp := filepath.Join(split...)
|
exp := filepath.Join(split...)
|
||||||
split = strings.Split(actual[i], "/")
|
for j := 0; j < len(actual); j++ {
|
||||||
act := filepath.Join(split...)
|
split = strings.Split(actual[j], "/")
|
||||||
if exp != act {
|
act := filepath.Join(split...)
|
||||||
return fmt.Errorf(`expected feature path "%s" at position: %d, does not match actual "%s"`, exp, i, act)
|
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
|
return nil
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче