aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/decode_test.go
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2025-01-14 12:43:27 -0800
committerJoseph Tsai <joetsai@digital-static.net>2025-01-14 14:54:07 -0800
commit368a9ec99834652ca3f7d8fe24862a7581e12358 (patch)
tree734b54f4207b7f3351a660a16897f4d1f92df428 /src/encoding/json/decode_test.go
parentbd80d8956f3062d2b2bff2d7da6b879dfa909f12 (diff)
downloadgo-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/decode_test.go')
-rw-r--r--src/encoding/json/decode_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/encoding/json/decode_test.go b/src/encoding/json/decode_test.go
index 3905a054ce..8aad11b8bf 100644
--- a/src/encoding/json/decode_test.go
+++ b/src/encoding/json/decode_test.go
@@ -1321,7 +1321,7 @@ func TestUnmarshal(t *testing.T) {
var scan scanner
if err := checkValid(in, &scan); err != nil {
if !equalError(err, tt.err) {
- t.Fatalf("%s: checkValid error: %#v", tt.Where, err)
+ t.Fatalf("%s: checkValid error:\n\tgot %#v\n\twant %#v", tt.Where, err, tt.err)
}
}
if tt.ptr == nil {
@@ -1355,7 +1355,7 @@ func TestUnmarshal(t *testing.T) {
dec.DisallowUnknownFields()
}
if err := dec.Decode(v.Interface()); !equalError(err, tt.err) {
- t.Fatalf("%s: Decode error:\n\tgot: %#v\n\twant: %#v", tt.Where, err, tt.err)
+ t.Fatalf("%s: Decode error:\n\tgot: %v\n\twant: %v\n\n\tgot: %#v\n\twant: %#v", tt.Where, err, tt.err, err, tt.err)
} else if err != nil && tt.out == nil {
// Initialize tt.out during an error where there are no mutations,
// so the output is just the zero value of the input type.