aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/decode_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/json/decode_test.go')
-rw-r--r--src/encoding/json/decode_test.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/encoding/json/decode_test.go b/src/encoding/json/decode_test.go
index 3c5fd1428f..a00cc15323 100644
--- a/src/encoding/json/decode_test.go
+++ b/src/encoding/json/decode_test.go
@@ -2099,7 +2099,10 @@ func TestSkipArrayObjects(t *testing.T) {
// slices, and arrays.
// Issues 4900 and 8837, among others.
func TestPrefilled(t *testing.T) {
- // Values here change, cannot reuse table across runs.
+ type T struct {
+ A, B int
+ }
+ // Values here change, cannot reuse the table across runs.
var prefillTests = []struct {
in string
ptr interface{}
@@ -2135,6 +2138,16 @@ func TestPrefilled(t *testing.T) {
ptr: &[...]int{1, 2},
out: &[...]int{3, 0},
},
+ {
+ in: `[{"A": 3}]`,
+ ptr: &[]T{{A: -1, B: -2}, {A: -3, B: -4}},
+ out: &[]T{{A: 3}},
+ },
+ {
+ in: `[{"A": 3}]`,
+ ptr: &[...]T{{A: -1, B: -2}, {A: -3, B: -4}},
+ out: &[...]T{{A: 3, B: -2}, {}},
+ },
}
for _, tt := range prefillTests {