diff options
Diffstat (limited to 'src/pkg/encoding/json/decode_test.go')
-rw-r--r-- | src/pkg/encoding/json/decode_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pkg/encoding/json/decode_test.go b/src/pkg/encoding/json/decode_test.go index e1bd918dd..037c5b236 100644 --- a/src/pkg/encoding/json/decode_test.go +++ b/src/pkg/encoding/json/decode_test.go @@ -1178,3 +1178,16 @@ func TestUnmarshalJSONLiteralError(t *testing.T) { t.Errorf("got err = %v; want out of range error", err) } } + +// Test that extra object elements in an array do not result in a +// "data changing underfoot" error. +// Issue 3717 +func TestSkipArrayObjects(t *testing.T) { + json := `[{}]` + var dest [0]interface{} + + err := Unmarshal([]byte(json), &dest) + if err != nil { + t.Errorf("got error %q, want nil", err) + } +} |