Skip to content

Commit

Permalink
Rename end to strays
Browse files Browse the repository at this point in the history
  • Loading branch information
dnephin committed Sep 17, 2024
1 parent 8af2bf1 commit acaaabc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions testjson/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ func (p *Package) IsEmpty() bool {

const neverFinished time.Duration = -1

// end adds any tests that were missing an ActionFail TestEvent to the list of
// strays adds any tests that were missing an ActionFail TestEvent to the list of
// Failed, and returns a slice of artificial TestEvent for the missing ones.
//
// This is done to work around 'go test' not sending the ActionFail TestEvents
// in some cases, when a test panics.
func (p *Package) end() []TestEvent {
func (p *Package) strays() []TestEvent {
result := make([]TestEvent, 0, len(p.running))
for k, tc := range p.running {
if tc.Test.IsSubTest() && rootTestPassed(p, tc) {
Expand Down Expand Up @@ -647,11 +647,10 @@ func (e *Execution) HasPanic() bool {
return false
}

func (e *Execution) end() []TestEvent {
e.done = true
func (e *Execution) Strays() []TestEvent {
var result []TestEvent // nolint: prealloc
for _, pkg := range e.packages {
result = append(result, pkg.end()...)
result = append(result, pkg.strays()...)
}
return result
}
Expand Down Expand Up @@ -734,11 +733,12 @@ func ScanTestOutput(config ScanConfig) (*Execution, error) {
})

err := group.Wait()
for _, event := range execution.end() {
for _, event := range execution.Strays() {
if err := config.Handler.Event(event, execution); err != nil {
return execution, err
}
}
execution.done = true
return execution, err
}

Expand Down

0 comments on commit acaaabc

Please sign in to comment.