2018-02-13 17:49:40 +02:00
|
|
|
package test
|
|
|
|
|
|
|
|
func init() {
|
2018-02-14 02:58:59 +02:00
|
|
|
var pInt = func(val int) *int {
|
|
|
|
return &val
|
|
|
|
}
|
2018-02-13 17:49:40 +02:00
|
|
|
marshalCases = append(marshalCases,
|
2018-02-14 02:58:59 +02:00
|
|
|
(*int)(nil),
|
|
|
|
pInt(100),
|
2018-02-13 17:49:40 +02:00
|
|
|
)
|
2018-02-21 06:16:50 +02:00
|
|
|
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",
|
|
|
|
})
|
2018-02-14 02:58:59 +02:00
|
|
|
}
|