1
0
mirror of https://github.com/json-iterator/go.git synced 2024-11-24 08:22:14 +02:00
json-iterator/value_tests/ptr_test.go
2018-02-21 12:16:50 +08:00

40 lines
609 B
Go

package test
func init() {
var pInt = func(val int) *int {
return &val
}
marshalCases = append(marshalCases,
(*int)(nil),
pInt(100),
)
unmarshalCases = append(unmarshalCases, unmarshalCase{
obj: func() interface{} {
var i int
return &i
},
input: "null",
}, unmarshalCase{
obj: func() interface{} {
var i *int
return &i
},
input: "10",
}, unmarshalCase{
obj: func() interface{} {
var i int
pi := &i
return &pi
},
input: "null",
}, unmarshalCase{
obj: func() interface{} {
var i int
pi := &i
ppi := &pi
return &ppi
},
input: "null",
})
}