Fix cmp.Diff argument order in tests

This commit is contained in:
Joël Stemmer
2022-05-07 12:59:39 +01:00
parent 7c195be87f
commit df7394c77c
4 changed files with 16 additions and 15 deletions

View File

@ -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)
}
}