Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexported some exported properties in unexported structs #303

Merged
merged 1 commit into from
Jun 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions fmt_cucumber.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions fmt_junit.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ 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)
for idx, pickleResult := range feat.pickleResults {
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])
Expand Down
6 changes: 3 additions & 3 deletions fmt_pretty.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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")
}
}
Expand Down
18 changes: 9 additions & 9 deletions suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}
}

Expand Down
4 changes: 2 additions & 2 deletions suite_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions suite_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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) {
Expand Down