diff options
| author | Joe Tsai <joetsai@digital-static.net> | 2025-01-14 12:43:27 -0800 |
|---|---|---|
| committer | Joseph Tsai <joetsai@digital-static.net> | 2025-01-14 14:54:07 -0800 |
| commit | 368a9ec99834652ca3f7d8fe24862a7581e12358 (patch) | |
| tree | 734b54f4207b7f3351a660a16897f4d1f92df428 /src/encoding/json/stream_test.go | |
| parent | bd80d8956f3062d2b2bff2d7da6b879dfa909f12 (diff) | |
| download | go-368a9ec99834652ca3f7d8fe24862a7581e12358.tar.xz | |
encoding/json: cleanup tests
Perform minor cleanups in tests to improve printout of diffs
and/or follow modern coding style.
This reduces the amount of diffs between v1 and the v2 prototype.
Change-Id: I019bb9642e2135f2fa3eac6abfa6df91c397aa82
Reviewed-on: https://go-review.googlesource.com/c/go/+/642257
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/encoding/json/stream_test.go')
| -rw-r--r-- | src/encoding/json/stream_test.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/encoding/json/stream_test.go b/src/encoding/json/stream_test.go index 32ede8cc7e..46f9407c88 100644 --- a/src/encoding/json/stream_test.go +++ b/src/encoding/json/stream_test.go @@ -79,9 +79,9 @@ func TestEncoder(t *testing.T) { t.Fatalf("#%d.%d Encode error: %v", i, j, err) } } - if have, want := buf.String(), nlines(streamEncoded, i); have != want { + if got, want := buf.String(), nlines(streamEncoded, i); got != want { t.Errorf("encoding %d items: mismatch:", i) - diff(t, []byte(have), []byte(want)) + diff(t, []byte(got), []byte(want)) break } } @@ -148,9 +148,9 @@ func TestEncoderIndent(t *testing.T) { for _, v := range streamTest { enc.Encode(v) } - if have, want := buf.String(), streamEncodedIndent; have != want { - t.Error("Encode mismatch:") - diff(t, []byte(have), []byte(want)) + if got, want := buf.String(), streamEncodedIndent; got != want { + t.Errorf("Encode mismatch:\ngot:\n%s\n\nwant:\n%s", got, want) + diff(t, []byte(got), []byte(want)) } } |
