Merge pull request #303 from cucumber/unexported-some-exported-properties
Unexported some exported properties in unexported structs
Этот коммит содержится в:
коммит
055f87f731
7 изменённых файлов: 22 добавлений и 22 удалений
4
fmt.go
4
fmt.go
|
@ -245,7 +245,7 @@ func (f *basefmt) Pickle(p *messages.Pickle) {
|
||||||
|
|
||||||
feature := f.features[len(f.features)-1]
|
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)
|
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.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) {
|
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))
|
res = make([]cukeElement, len(pickleResults))
|
||||||
|
|
||||||
for idx, pickleResult := range pickleResults {
|
for idx, pickleResult := range pickleResults {
|
||||||
cukeElement := f.buildCukeElement(pickleResult.Name, pickleResult.AstNodeIDs)
|
cukeElement := f.buildCukeElement(pickleResult.name, pickleResult.astNodeIDs)
|
||||||
|
|
||||||
stepStartedAt := pickleResult.startedAt()
|
stepStartedAt := pickleResult.startedAt()
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ type cukeFeatureJSON struct {
|
||||||
|
|
||||||
func buildCukeFeature(feat *feature) cukeFeatureJSON {
|
func buildCukeFeature(feat *feature) cukeFeatureJSON {
|
||||||
cukeFeature := cukeFeatureJSON{
|
cukeFeature := cukeFeatureJSON{
|
||||||
URI: feat.Path,
|
URI: feat.path,
|
||||||
ID: makeCukeID(feat.Feature.Name),
|
ID: makeCukeID(feat.Feature.Name),
|
||||||
Keyword: feat.Feature.Keyword,
|
Keyword: feat.Feature.Keyword,
|
||||||
Name: feat.Feature.Name,
|
Name: feat.Feature.Name,
|
||||||
|
|
|
@ -71,7 +71,7 @@ func buildJUNITPackageSuite(suiteName string, startedAt time.Time, features []*f
|
||||||
|
|
||||||
var testcaseNames = make(map[string]int)
|
var testcaseNames = make(map[string]int)
|
||||||
for _, pickleResult := range feat.pickleResults {
|
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)
|
var outlineNo = make(map[string]int)
|
||||||
|
@ -79,7 +79,7 @@ func buildJUNITPackageSuite(suiteName string, startedAt time.Time, features []*f
|
||||||
tc := junitTestCase{}
|
tc := junitTestCase{}
|
||||||
tc.Time = junitTimeDuration(pickleResult.startedAt(), pickleResult.finishedAt())
|
tc.Time = junitTimeDuration(pickleResult.startedAt(), pickleResult.finishedAt())
|
||||||
|
|
||||||
tc.Name = pickleResult.Name
|
tc.Name = pickleResult.name
|
||||||
if testcaseNames[tc.Name] > 1 {
|
if testcaseNames[tc.Name] > 1 {
|
||||||
outlineNo[tc.Name] = outlineNo[tc.Name] + 1
|
outlineNo[tc.Name] = outlineNo[tc.Name] + 1
|
||||||
tc.Name += fmt.Sprintf(" #%d", outlineNo[tc.Name])
|
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) {
|
func (f *pretty) printScenarioHeader(astScenario *messages.GherkinDocument_Feature_Scenario, spaceFilling int) {
|
||||||
text := s(f.indent) + keywordAndName(astScenario.Keyword, astScenario.Name)
|
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)
|
fmt.Fprintln(f.out, "\n"+text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,8 +204,8 @@ func (f *pretty) Summary() {
|
||||||
astStep := f.findStep(fail.step.AstNodeIds[0])
|
astStep := f.findStep(fail.step.AstNodeIds[0])
|
||||||
stepDesc := strings.TrimSpace(astStep.Keyword) + " " + fail.step.Text
|
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)+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*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")
|
fmt.Fprintln(f.out, s(f.indent*3)+red("Error: ")+redb(fmt.Sprintf("%+v", fail.err))+"\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
18
suite.go
18
suite.go
|
@ -27,8 +27,8 @@ type feature struct {
|
||||||
pickleResults []*pickleResult
|
pickleResults []*pickleResult
|
||||||
|
|
||||||
time time.Time
|
time time.Time
|
||||||
Content []byte `json:"-"`
|
content []byte
|
||||||
Path string `json:"path"`
|
path string
|
||||||
order int
|
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] }
|
func (s sortByName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||||
|
|
||||||
type pickleResult struct {
|
type pickleResult struct {
|
||||||
Name string
|
name string
|
||||||
AstNodeIDs []string
|
astNodeIDs []string
|
||||||
time time.Time
|
time time.Time
|
||||||
stepResults []*stepResult
|
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() {
|
defer func() {
|
||||||
if !isEmptyFeature(f.pickles) {
|
if !isEmptyFeature(f.pickles) {
|
||||||
|
@ -686,8 +686,8 @@ func parseFeatureFile(path string, newIDFunc func() string) (*feature, error) {
|
||||||
return &feature{
|
return &feature{
|
||||||
GherkinDocument: gherkinDocument,
|
GherkinDocument: gherkinDocument,
|
||||||
pickles: pickles,
|
pickles: pickles,
|
||||||
Content: buf.Bytes(),
|
content: buf.Bytes(),
|
||||||
Path: path,
|
path: path,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -765,13 +765,13 @@ func parseFeatures(filter string, paths []string) ([]*feature, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, ft := range feats {
|
for _, ft := range feats {
|
||||||
if _, duplicate := byPath[ft.Path]; duplicate {
|
if _, duplicate := byPath[ft.path]; duplicate {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
ft.order = order
|
ft.order = 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 {
|
func (s *suiteContext) aFeatureFile(path string, body *DocString) error {
|
||||||
gd, err := gherkin.ParseGherkinDocument(strings.NewReader(body.Content), (&messages.Incrementing{}).NewId)
|
gd, err := gherkin.ParseGherkinDocument(strings.NewReader(body.Content), (&messages.Incrementing{}).NewId)
|
||||||
pickles := gherkin.Pickles(*gd, path, (&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
|
return err
|
||||||
}
|
}
|
||||||
|
@ -455,7 +455,7 @@ func (s *suiteContext) iShouldHaveNumFeatureFiles(num int, files *DocString) err
|
||||||
var actual []string
|
var actual []string
|
||||||
|
|
||||||
for _, ft := range s.testedSuite.features {
|
for _, ft := range s.testedSuite.features {
|
||||||
actual = append(actual, ft.Path)
|
actual = append(actual, ft.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(expected) != len(actual) {
|
if len(expected) != len(actual) {
|
||||||
|
|
|
@ -374,7 +374,7 @@ func (tc *godogFeaturesScenario) aFailingStep() error {
|
||||||
func (tc *godogFeaturesScenario) aFeatureFile(path string, body *DocString) error {
|
func (tc *godogFeaturesScenario) aFeatureFile(path string, body *DocString) error {
|
||||||
gd, err := gherkin.ParseGherkinDocument(strings.NewReader(body.Content), (&messages.Incrementing{}).NewId)
|
gd, err := gherkin.ParseGherkinDocument(strings.NewReader(body.Content), (&messages.Incrementing{}).NewId)
|
||||||
pickles := gherkin.Pickles(*gd, path, (&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
|
return err
|
||||||
}
|
}
|
||||||
|
@ -417,7 +417,7 @@ func (tc *godogFeaturesScenario) iShouldHaveNumFeatureFiles(num int, files *DocS
|
||||||
var actual []string
|
var actual []string
|
||||||
|
|
||||||
for _, ft := range tc.testedSuite.features {
|
for _, ft := range tc.testedSuite.features {
|
||||||
actual = append(actual, ft.Path)
|
actual = append(actual, ft.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(expected) != len(actual) {
|
if len(expected) != len(actual) {
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче