diff options
Diffstat (limited to 'src/pkg/encoding/json/decode_test.go')
-rw-r--r-- | src/pkg/encoding/json/decode_test.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/pkg/encoding/json/decode_test.go b/src/pkg/encoding/json/decode_test.go index e1bd918dd..f845f69ab 100644 --- a/src/pkg/encoding/json/decode_test.go +++ b/src/pkg/encoding/json/decode_test.go @@ -30,7 +30,7 @@ type V struct { F3 Number } -// ifaceNumAsFloat64/ifaceNumAsNumber are used to test unmarshalling with and +// ifaceNumAsFloat64/ifaceNumAsNumber are used to test unmarshaling with and // without UseNumber var ifaceNumAsFloat64 = map[string]interface{}{ "k1": float64(1), @@ -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) + } +} |