You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-07-06 23:37:39 +02:00
array is just like struct, one element case special for interface{
This commit is contained in:
@ -233,7 +233,7 @@ func Test_struct_with_not_nil_embedded(t *testing.T) {
|
||||
should.Equal("1", obj.Field0)
|
||||
}
|
||||
|
||||
func Test_array_with_one_nil(t *testing.T) {
|
||||
func Test_array_with_one_nil_ptr(t *testing.T) {
|
||||
obj := [1]*float64{nil}
|
||||
should := require.New(t)
|
||||
output, err := MarshalToString(obj)
|
||||
@ -241,6 +241,15 @@ func Test_array_with_one_nil(t *testing.T) {
|
||||
should.Equal(`[null]`, output)
|
||||
}
|
||||
|
||||
func Test_array_with_one_not_nil_ptr(t *testing.T) {
|
||||
two := float64(2)
|
||||
obj := [1]*float64{&two}
|
||||
should := require.New(t)
|
||||
output, err := MarshalToString(obj)
|
||||
should.Nil(err)
|
||||
should.Equal(`[2]`, output)
|
||||
}
|
||||
|
||||
func Test_embedded_array_with_one_nil(t *testing.T) {
|
||||
type TestObject struct {
|
||||
Field1 int
|
||||
|
Reference in New Issue
Block a user