1 // Copyright 2018 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // This file contains tests for the unmarshal checker.
24 json.Unmarshal([]byte{}, v) // want "call of Unmarshal passes non-pointer as second argument"
25 json.Unmarshal([]byte{}, &v)
26 json.NewDecoder(r).Decode(v) // want "call of Decode passes non-pointer"
27 json.NewDecoder(r).Decode(&v)
28 gob.NewDecoder(r).Decode(v) // want "call of Decode passes non-pointer"
29 gob.NewDecoder(r).Decode(&v)
30 xml.Unmarshal([]byte{}, v) // want "call of Unmarshal passes non-pointer as second argument"
31 xml.Unmarshal([]byte{}, &v)
32 xml.NewDecoder(r).Decode(v) // want "call of Decode passes non-pointer"
33 xml.NewDecoder(r).Decode(&v)
34 asn1.Unmarshal([]byte{}, v) // want "call of Unmarshal passes non-pointer as second argument"
35 asn1.Unmarshal([]byte{}, &v)
38 json.Unmarshal([]byte{}, p)
39 json.Unmarshal([]byte{}, *p) // want "call of Unmarshal passes non-pointer as second argument"
40 json.NewDecoder(r).Decode(p)
41 json.NewDecoder(r).Decode(*p) // want "call of Decode passes non-pointer"
42 gob.NewDecoder(r).Decode(p)
43 gob.NewDecoder(r).Decode(*p) // want "call of Decode passes non-pointer"
44 xml.Unmarshal([]byte{}, p)
45 xml.Unmarshal([]byte{}, *p) // want "call of Unmarshal passes non-pointer as second argument"
46 xml.NewDecoder(r).Decode(p)
47 xml.NewDecoder(r).Decode(*p) // want "call of Decode passes non-pointer"
48 asn1.Unmarshal([]byte{}, p)
49 asn1.Unmarshal([]byte{}, *p) // want "call of Unmarshal passes non-pointer as second argument"
52 json.Unmarshal([]byte{}, i)
53 json.NewDecoder(r).Decode(i)
55 json.Unmarshal([]byte{}, nil) // want "call of Unmarshal passes non-pointer as second argument"
56 json.Unmarshal([]byte{}, []t{}) // want "call of Unmarshal passes non-pointer as second argument"
57 json.Unmarshal([]byte{}, map[string]int{}) // want "call of Unmarshal passes non-pointer as second argument"
58 json.NewDecoder(r).Decode(nil) // want "call of Decode passes non-pointer"
59 json.NewDecoder(r).Decode([]t{}) // want "call of Decode passes non-pointer"
60 json.NewDecoder(r).Decode(map[string]int{}) // want "call of Decode passes non-pointer"
62 json.Unmarshal(func() ([]byte, interface{}) { return []byte{}, v }())