diff options
Diffstat (limited to 'src/encoding/json/decode_test.go')
| -rw-r--r-- | src/encoding/json/decode_test.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/encoding/json/decode_test.go b/src/encoding/json/decode_test.go index d99d65d763..8da74fa3d3 100644 --- a/src/encoding/json/decode_test.go +++ b/src/encoding/json/decode_test.go @@ -50,7 +50,8 @@ type P struct { } type PP struct { - T T + T T + Ts []T } type SS string @@ -943,6 +944,17 @@ var unmarshalTests = []unmarshalTest{ Offset: 29, }, }, + { + in: `{"Ts": [{"Y": 1}, {"Y": 2}, {"Y": "bad-type"}]}`, + ptr: new(PP), + err: &UnmarshalTypeError{ + Value: "string", + Struct: "T", + Field: "Ts.Y", + Type: reflect.TypeOf(int(0)), + Offset: 29, + }, + }, } func TestMarshal(t *testing.T) { |
