mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-07-03 04:32:47 -05:00
Fix cmp.Diff argument order in tests
This commit is contained in:
@ -208,7 +208,7 @@ func TestParseLine(t *testing.T) {
|
||||
parser := NewParser()
|
||||
parser.parseLine(test.input)
|
||||
got := parser.events
|
||||
if diff := cmp.Diff(got, want); diff != "" {
|
||||
if diff := cmp.Diff(want, got); diff != "" {
|
||||
t.Errorf("parseLine(%q) returned unexpected events, diff (-want, +got):\n%v", test.input, diff)
|
||||
}
|
||||
})
|
||||
@ -242,7 +242,7 @@ func TestReport(t *testing.T) {
|
||||
{Type: "output", Data: "error message"},
|
||||
{Type: "summary", Result: "FAIL", Name: "package/failing1", Data: "[build failed]"},
|
||||
}
|
||||
expected := gtr.Report{
|
||||
want := gtr.Report{
|
||||
Packages: []gtr.Package{
|
||||
{
|
||||
Name: "package/name",
|
||||
@ -309,8 +309,8 @@ func TestReport(t *testing.T) {
|
||||
}
|
||||
|
||||
parser := NewParser(TimestampFunc(func() time.Time { return testTimestamp }))
|
||||
actual := parser.report(events)
|
||||
if diff := cmp.Diff(actual, expected); diff != "" {
|
||||
got := parser.report(events)
|
||||
if diff := cmp.Diff(want, got); diff != "" {
|
||||
t.Errorf("FromEvents report incorrect, diff (-want, +got):\n%v", diff)
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ func TestJSONReaderReadAll(t *testing.T) {
|
||||
=== RUN TestOK
|
||||
`
|
||||
|
||||
if diff := cmp.Diff(string(got), want); diff != "" {
|
||||
if diff := cmp.Diff(want, string(got)); diff != "" {
|
||||
t.Errorf("unexpected result from jsonReader, diff (-want, +got):\n%s\n", diff)
|
||||
}
|
||||
}
|
||||
@ -51,7 +51,8 @@ func TestJSONReaderReadSmallBuffer(t *testing.T) {
|
||||
t.Fatalf("Read error: %v", err)
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(string(buf[:n]), string(want)); diff != "" {
|
||||
got := buf[:n]
|
||||
if diff := cmp.Diff(string(want), string(got)); diff != "" {
|
||||
t.Fatalf("unexpected result from jsonReader, diff (-want, +got):\n%s\n", diff)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user