...

Source file src/github.com/json-iterator/go/value_tests/ptr_test.go

Documentation: github.com/json-iterator/go/value_tests

     1  package test
     2  
     3  func init() {
     4  	var pInt = func(val int) *int {
     5  		return &val
     6  	}
     7  	marshalCases = append(marshalCases,
     8  		(*int)(nil),
     9  		pInt(100),
    10  	)
    11  	unmarshalCases = append(unmarshalCases, unmarshalCase{
    12  		obj: func() interface{} {
    13  			var i int
    14  			return &i
    15  		},
    16  		input: "null",
    17  	}, unmarshalCase{
    18  		obj: func() interface{} {
    19  			var i *int
    20  			return &i
    21  		},
    22  		input: "10",
    23  	}, unmarshalCase{
    24  		obj: func() interface{} {
    25  			var i int
    26  			pi := &i
    27  			return &pi
    28  		},
    29  		input: "null",
    30  	})
    31  }
    32  

View as plain text