Merge pull request #303 from cucumber/unexported-some-exported-properties

Unexported some exported properties in unexported structs
Этот коммит содержится в:
Fredrik Lönnblad 2020-06-07 15:38:43 +02:00 коммит произвёл GitHub
родитель c5a0a58123 df3ce739e8
коммит 055f87f731
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 22 добавлений и 22 удалений

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

@ -245,7 +245,7 @@ func (f *basefmt) Pickle(p *messages.Pickle) {
feature := f.features[len(f.features)-1]
pr := pickleResult{Name: p.Name, AstNodeIDs: p.AstNodeIds, time: timeNowFunc()}
pr := pickleResult{name: p.Name, astNodeIDs: p.AstNodeIds, time: timeNowFunc()}
feature.pickleResults = append(feature.pickleResults, &pr)
}
@ -257,7 +257,7 @@ func (f *basefmt) Feature(ft *messages.GherkinDocument, p string, c []byte) {
*f.firstFeature = false
f.features = append(f.features, &feature{Path: p, GherkinDocument: ft, time: timeNowFunc()})
f.features = append(f.features, &feature{path: p, GherkinDocument: ft, time: timeNowFunc()})
}
func (f *basefmt) Passed(pickle *messages.Pickle, step *messages.Pickle_PickleStep, match *StepDefinition) {

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

@ -79,7 +79,7 @@ func (f *cukefmt) buildCukeElements(pickleResults []*pickleResult) (res []cukeEl
res = make([]cukeElement, len(pickleResults))
for idx, pickleResult := range pickleResults {
cukeElement := f.buildCukeElement(pickleResult.Name, pickleResult.AstNodeIDs)
cukeElement := f.buildCukeElement(pickleResult.name, pickleResult.astNodeIDs)
stepStartedAt := pickleResult.startedAt()
@ -170,7 +170,7 @@ type cukeFeatureJSON struct {
func buildCukeFeature(feat *feature) cukeFeatureJSON {
cukeFeature := cukeFeatureJSON{
URI: feat.Path,
URI: feat.path,
ID: makeCukeID(feat.Feature.Name),
Keyword: feat.Feature.Keyword,
Name: feat.Feature.Name,

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

@ -71,7 +71,7 @@ func buildJUNITPackageSuite(suiteName string, startedAt time.Time, features []*f
var testcaseNames = make(map[string]int)
for _, pickleResult := range feat.pickleResults {
testcaseNames[pickleResult.Name] = testcaseNames[pickleResult.Name] + 1
testcaseNames[pickleResult.name] = testcaseNames[pickleResult.name] + 1
}
var outlineNo = make(map[string]int)
@ -79,7 +79,7 @@ func buildJUNITPackageSuite(suiteName string, startedAt time.Time, features []*f
tc := junitTestCase{}
tc.Time = junitTimeDuration(pickleResult.startedAt(), pickleResult.finishedAt())
tc.Name = pickleResult.Name
tc.Name = pickleResult.name
if testcaseNames[tc.Name] > 1 {
outlineNo[tc.Name] = outlineNo[tc.Name] + 1
tc.Name += fmt.Sprintf(" #%d", outlineNo[tc.Name])

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

@ -145,7 +145,7 @@ func (f *pretty) scenarioLengths(scenarioAstID string) (scenarioHeaderLength int
func (f *pretty) printScenarioHeader(astScenario *messages.GherkinDocument_Feature_Scenario, spaceFilling int) {
text := s(f.indent) + keywordAndName(astScenario.Keyword, astScenario.Name)
text += s(spaceFilling) + f.line(f.lastFeature().Path, astScenario.Location)
text += s(spaceFilling) + f.line(f.lastFeature().path, astScenario.Location)
fmt.Fprintln(f.out, "\n"+text)
}
@ -204,8 +204,8 @@ func (f *pretty) Summary() {
astStep := f.findStep(fail.step.AstNodeIds[0])
stepDesc := strings.TrimSpace(astStep.Keyword) + " " + fail.step.Text
fmt.Fprintln(f.out, s(f.indent)+red(scenarioDesc)+f.line(feature.Path, astScenario.Location))
fmt.Fprintln(f.out, s(f.indent*2)+red(stepDesc)+f.line(feature.Path, astStep.Location))
fmt.Fprintln(f.out, s(f.indent)+red(scenarioDesc)+f.line(feature.path, astScenario.Location))
fmt.Fprintln(f.out, s(f.indent*2)+red(stepDesc)+f.line(feature.path, astStep.Location))
fmt.Fprintln(f.out, s(f.indent*3)+red("Error: ")+redb(fmt.Sprintf("%+v", fail.err))+"\n")
}
}

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

@ -27,8 +27,8 @@ type feature struct {
pickleResults []*pickleResult
time time.Time
Content []byte `json:"-"`
Path string `json:"path"`
content []byte
path string
order int
}
@ -129,8 +129,8 @@ func (s sortByName) Less(i, j int) bool { return s[i].Feature.Name < s[j].Featur
func (s sortByName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
type pickleResult struct {
Name string
AstNodeIDs []string
name string
astNodeIDs []string
time time.Time
stepResults []*stepResult
}
@ -575,7 +575,7 @@ func (s *Suite) runFeature(f *feature) {
}
}
s.fmt.Feature(f.GherkinDocument, f.Path, f.Content)
s.fmt.Feature(f.GherkinDocument, f.path, f.content)
defer func() {
if !isEmptyFeature(f.pickles) {
@ -686,8 +686,8 @@ func parseFeatureFile(path string, newIDFunc func() string) (*feature, error) {
return &feature{
GherkinDocument: gherkinDocument,
pickles: pickles,
Content: buf.Bytes(),
Path: path,
content: buf.Bytes(),
path: path,
}, nil
}
@ -765,13 +765,13 @@ func parseFeatures(filter string, paths []string) ([]*feature, error) {
}
for _, ft := range feats {
if _, duplicate := byPath[ft.Path]; duplicate {
if _, duplicate := byPath[ft.path]; duplicate {
continue
}
ft.order = order
order++
byPath[ft.Path] = ft
byPath[ft.path] = ft
}
}

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

@ -412,7 +412,7 @@ func (s *suiteContext) aFailingStep() error {
func (s *suiteContext) aFeatureFile(path string, body *DocString) error {
gd, err := gherkin.ParseGherkinDocument(strings.NewReader(body.Content), (&messages.Incrementing{}).NewId)
pickles := gherkin.Pickles(*gd, path, (&messages.Incrementing{}).NewId)
s.testedSuite.features = append(s.testedSuite.features, &feature{GherkinDocument: gd, pickles: pickles, Path: path})
s.testedSuite.features = append(s.testedSuite.features, &feature{GherkinDocument: gd, pickles: pickles, path: path})
return err
}
@ -455,7 +455,7 @@ func (s *suiteContext) iShouldHaveNumFeatureFiles(num int, files *DocString) err
var actual []string
for _, ft := range s.testedSuite.features {
actual = append(actual, ft.Path)
actual = append(actual, ft.path)
}
if len(expected) != len(actual) {

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

@ -374,7 +374,7 @@ func (tc *godogFeaturesScenario) aFailingStep() error {
func (tc *godogFeaturesScenario) aFeatureFile(path string, body *DocString) error {
gd, err := gherkin.ParseGherkinDocument(strings.NewReader(body.Content), (&messages.Incrementing{}).NewId)
pickles := gherkin.Pickles(*gd, path, (&messages.Incrementing{}).NewId)
tc.testedSuite.features = append(tc.testedSuite.features, &feature{GherkinDocument: gd, pickles: pickles, Path: path})
tc.testedSuite.features = append(tc.testedSuite.features, &feature{GherkinDocument: gd, pickles: pickles, path: path})
return err
}
@ -417,7 +417,7 @@ func (tc *godogFeaturesScenario) iShouldHaveNumFeatureFiles(num int, files *DocS
var actual []string
for _, ft := range tc.testedSuite.features {
actual = append(actual, ft.Path)
actual = append(actual, ft.path)
}
if len(expected) != len(actual) {