mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-07-09 23:33:46 -05:00
parser/gotest: rename New/NewJSON -> NewParser/NewJSONParser
This commit is contained in:
@ -57,8 +57,8 @@ func TimestampFunc(f func() time.Time) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// New returns a new Go test output parser.
|
||||
func New(options ...Option) *Parser {
|
||||
// NewParser returns a new Go test output parser.
|
||||
func NewParser(options ...Option) *Parser {
|
||||
p := &Parser{}
|
||||
for _, option := range options {
|
||||
option(p)
|
||||
|
@ -204,7 +204,7 @@ func TestParseLine(t *testing.T) {
|
||||
|
||||
name := fmt.Sprintf("%d %s", i+1, strings.Join(types, ","))
|
||||
t.Run(name, func(t *testing.T) {
|
||||
parser := New()
|
||||
parser := NewParser()
|
||||
parser.parseLine(test.input)
|
||||
got := parser.events
|
||||
if diff := cmp.Diff(got, want); diff != "" {
|
||||
@ -307,7 +307,7 @@ func TestReport(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
parser := New(TimestampFunc(func() time.Time { return testTimestamp }))
|
||||
parser := NewParser(TimestampFunc(func() time.Time { return testTimestamp }))
|
||||
actual := parser.report(events)
|
||||
if diff := cmp.Diff(actual, expected); diff != "" {
|
||||
t.Errorf("FromEvents report incorrect, diff (-want, +got):\n%v", diff)
|
||||
|
@ -9,9 +9,9 @@ import (
|
||||
"github.com/jstemmer/go-junit-report/v2/pkg/gtr"
|
||||
)
|
||||
|
||||
// New returns a new Go test json output parser.
|
||||
func NewJSON(options ...Option) *JSONParser {
|
||||
return &JSONParser{gp: New(options...)}
|
||||
// NewJSONParser returns a new Go test json output parser.
|
||||
func NewJSONParser(options ...Option) *JSONParser {
|
||||
return &JSONParser{gp: NewParser(options...)}
|
||||
}
|
||||
|
||||
// Parser is a Go test json output Parser.
|
||||
|
Reference in New Issue
Block a user