2021-01-16 16:16:26 +03:00
package json_test
import (
"bytes"
"testing"
"github.com/goccy/go-json"
)
func TestCoverInt ( t * testing . T ) {
type structInt struct {
A int ` json:"a" `
}
type structIntOmitEmpty struct {
A int ` json:"a,omitempty" `
}
type structIntString struct {
A int ` json:"a,string" `
}
2021-05-06 18:55:15 +03:00
type structIntStringOmitEmpty struct {
A int ` json:"a,omitempty,string" `
}
2021-01-16 16:16:26 +03:00
type structIntPtr struct {
A * int ` json:"a" `
}
type structIntPtrOmitEmpty struct {
A * int ` json:"a,omitempty" `
}
type structIntPtrString struct {
A * int ` json:"a,string" `
}
2021-05-06 18:55:15 +03:00
type structIntPtrStringOmitEmpty struct {
A * int ` json:"a,omitempty,string" `
}
2021-01-16 16:16:26 +03:00
tests := [ ] struct {
2021-02-14 20:08:05 +03:00
name string
data interface { }
2021-01-16 16:16:26 +03:00
} {
2021-03-19 17:31:29 +03:00
{
name : "Int" ,
data : 10 ,
} ,
{
name : "IntPtr" ,
data : intptr ( 10 ) ,
} ,
{
name : "IntPtr3" ,
data : intptr3 ( 10 ) ,
} ,
{
name : "IntPtrNil" ,
data : ( * int ) ( nil ) ,
} ,
{
name : "IntPtr3Nil" ,
data : ( * * * int ) ( nil ) ,
} ,
2021-01-16 16:16:26 +03:00
// HeadIntZero
{
2021-02-14 20:08:05 +03:00
name : "HeadIntZero" ,
2021-01-16 16:16:26 +03:00
data : struct {
A int ` json:"a" `
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntZeroOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A int ` json:"a,omitempty" `
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntZeroString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A int ` json:"a,string" `
} { } ,
} ,
// HeadInt
{
2021-02-14 20:08:05 +03:00
name : "HeadInt" ,
2021-01-16 16:16:26 +03:00
data : struct {
A int ` json:"a" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A int ` json:"a,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A int ` json:"a,string" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } ,
2021-01-16 16:16:26 +03:00
} ,
// HeadIntPtr
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtr" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * int ` json:"a" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * int ` json:"a,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * int ` json:"a,string" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
} ,
// HeadIntPtrNil
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNil" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * int ` json:"a" `
} { A : nil } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNilOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * int ` json:"a,omitempty" `
} { A : nil } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNilString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * int ` json:"a,string" `
} { A : nil } ,
} ,
// PtrHeadIntZero
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntZero" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A int ` json:"a" `
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntZeroOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A int ` json:"a,omitempty" `
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntZeroString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A int ` json:"a,string" `
} { } ,
} ,
2021-05-06 18:55:15 +03:00
{
name : "PtrHeadIntZeroStringOmitEmpty" ,
data : & struct {
A int ` json:"a,string,omitempty" `
} { } ,
} ,
2021-01-16 16:16:26 +03:00
// PtrHeadInt
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadInt" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A int ` json:"a" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A int ` json:"a,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A int ` json:"a,string" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } ,
2021-01-16 16:16:26 +03:00
} ,
// PtrHeadIntPtr
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtr" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * int ` json:"a" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * int ` json:"a,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * int ` json:"a,string" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
} ,
// PtrHeadIntPtrNil
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNil" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * int ` json:"a" `
} { A : nil } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * int ` json:"a,omitempty" `
} { A : nil } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * int ` json:"a,string" `
} { A : nil } ,
} ,
// PtrHeadIntNil
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNil" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * int ` json:"a" `
} ) ( nil ) ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * int ` json:"a,omitempty" `
} ) ( nil ) ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilString" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * int ` json:"a,string" `
} ) ( nil ) ,
} ,
// HeadIntZeroMultiFields
{
2021-02-14 20:08:05 +03:00
name : "HeadIntZeroMultiFields" ,
2021-01-16 16:16:26 +03:00
data : struct {
A int ` json:"a" `
B int ` json:"b" `
2021-02-14 20:08:05 +03:00
C int ` json:"c" `
2021-01-16 16:16:26 +03:00
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntZeroMultiFieldsOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A int ` json:"a,omitempty" `
B int ` json:"b,omitempty" `
2021-02-14 20:08:05 +03:00
C int ` json:"c,omitempty" `
2021-01-16 16:16:26 +03:00
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntZeroMultiFields" ,
2021-01-16 16:16:26 +03:00
data : struct {
A int ` json:"a,string" `
B int ` json:"b,string" `
2021-02-14 20:08:05 +03:00
C int ` json:"c,string" `
2021-01-16 16:16:26 +03:00
} { } ,
} ,
// HeadIntMultiFields
{
2021-02-14 20:08:05 +03:00
name : "HeadIntMultiFields" ,
2021-01-16 16:16:26 +03:00
data : struct {
A int ` json:"a" `
B int ` json:"b" `
2021-02-14 20:08:05 +03:00
C int ` json:"c" `
2021-02-19 09:13:33 +03:00
} { A : - 1 , B : 2 , C : 3 } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntMultiFieldsOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A int ` json:"a,omitempty" `
B int ` json:"b,omitempty" `
2021-02-14 20:08:05 +03:00
C int ` json:"c,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : - 1 , B : 2 , C : 3 } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntMultiFieldsString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A int ` json:"a,string" `
B int ` json:"b,string" `
2021-02-14 20:08:05 +03:00
C int ` json:"c,string" `
2021-02-19 09:13:33 +03:00
} { A : - 1 , B : 2 , C : 3 } ,
2021-01-16 16:16:26 +03:00
} ,
// HeadIntPtrMultiFields
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrMultiFields" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * int ` json:"a" `
B * int ` json:"b" `
2021-02-14 20:08:05 +03:00
C * int ` json:"c" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) , B : intptr ( 2 ) , C : intptr ( 3 ) } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrMultiFieldsOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * int ` json:"a,omitempty" `
B * int ` json:"b,omitempty" `
2021-02-14 20:08:05 +03:00
C * int ` json:"c,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) , B : intptr ( 2 ) , C : intptr ( 3 ) } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrMultiFieldsString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * int ` json:"a,string" `
B * int ` json:"b,string" `
2021-02-14 20:08:05 +03:00
C * int ` json:"c,string" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) , B : intptr ( 2 ) , C : intptr ( 3 ) } ,
2021-01-16 16:16:26 +03:00
} ,
// HeadIntPtrNilMultiFields
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNilMultiFields" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * int ` json:"a" `
B * int ` json:"b" `
2021-02-14 20:08:05 +03:00
C * int ` json:"c" `
} { A : nil , B : nil , C : nil } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNilMultiFieldsOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * int ` json:"a,omitempty" `
B * int ` json:"b,omitempty" `
2021-02-14 20:08:05 +03:00
C * int ` json:"c,omitempty" `
} { A : nil , B : nil , C : nil } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNilMultiFieldsString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * int ` json:"a,string" `
B * int ` json:"b,string" `
2021-02-14 20:08:05 +03:00
C * int ` json:"c,string" `
} { A : nil , B : nil , C : nil } ,
2021-01-16 16:16:26 +03:00
} ,
// PtrHeadIntZeroMultiFields
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntZeroMultiFields" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A int ` json:"a" `
B int ` json:"b" `
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntZeroMultiFieldsOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A int ` json:"a,omitempty" `
B int ` json:"b,omitempty" `
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntZeroMultiFieldsString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A int ` json:"a,string" `
B int ` json:"b,string" `
} { } ,
} ,
// PtrHeadIntMultiFields
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntMultiFields" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A int ` json:"a" `
B int ` json:"b" `
2021-02-19 09:13:33 +03:00
} { A : - 1 , B : 2 } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntMultiFieldsOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A int ` json:"a,omitempty" `
B int ` json:"b,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : - 1 , B : 2 } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntMultiFieldsString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A int ` json:"a,string" `
B int ` json:"b,string" `
2021-02-19 09:13:33 +03:00
} { A : - 1 , B : 2 } ,
2021-01-16 16:16:26 +03:00
} ,
// PtrHeadIntPtrMultiFields
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrMultiFields" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * int ` json:"a" `
B * int ` json:"b" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) , B : intptr ( 2 ) } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrMultiFieldsOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * int ` json:"a,omitempty" `
B * int ` json:"b,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) , B : intptr ( 2 ) } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrMultiFieldsString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * int ` json:"a,string" `
B * int ` json:"b,string" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) , B : intptr ( 2 ) } ,
2021-01-16 16:16:26 +03:00
} ,
// PtrHeadIntPtrNilMultiFields
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilMultiFields" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * int ` json:"a" `
B * int ` json:"b" `
} { A : nil , B : nil } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilMultiFieldsOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * int ` json:"a,omitempty" `
B * int ` json:"b,omitempty" `
} { A : nil , B : nil } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilMultiFieldsString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * int ` json:"a,string" `
B * int ` json:"b,string" `
} { A : nil , B : nil } ,
} ,
// PtrHeadIntNilMultiFields
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilMultiFields" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * int ` json:"a" `
B * int ` json:"b" `
} ) ( nil ) ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilMultiFieldsOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * int ` json:"a,omitempty" `
B * int ` json:"b,omitempty" `
} ) ( nil ) ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilMultiFieldsString" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * int ` json:"a,string" `
B * int ` json:"b,string" `
} ) ( nil ) ,
} ,
// HeadIntZeroNotRoot
{
2021-02-14 20:08:05 +03:00
name : "HeadIntZeroNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A int ` json:"a" `
}
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntZeroNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A int ` json:"a,omitempty" `
}
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntZeroNotRootString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A int ` json:"a,string" `
}
} { } ,
} ,
// HeadIntNotRoot
{
2021-02-14 20:08:05 +03:00
name : "HeadIntNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A int ` json:"a" `
}
} { A : struct {
A int ` json:"a" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A int ` json:"a,omitempty" `
}
} { A : struct {
A int ` json:"a,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntNotRootString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A int ` json:"a,string" `
}
} { A : struct {
A int ` json:"a,string" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } } ,
2021-01-16 16:16:26 +03:00
} ,
// HeadIntPtrNotRoot
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * int ` json:"a" `
}
} { A : struct {
A * int ` json:"a" `
2021-02-19 09:13:33 +03:00
} { intptr ( - 1 ) } } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * int ` json:"a,omitempty" `
}
} { A : struct {
A * int ` json:"a,omitempty" `
2021-02-19 09:13:33 +03:00
} { intptr ( - 1 ) } } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNotRootString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * int ` json:"a,string" `
}
} { A : struct {
A * int ` json:"a,string" `
2021-02-19 09:13:33 +03:00
} { intptr ( - 1 ) } } ,
2021-01-16 16:16:26 +03:00
} ,
// HeadIntPtrNilNotRoot
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNilNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * int ` json:"a" `
}
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNilNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * int ` json:"a,omitempty" `
}
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNilNotRootString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * int ` json:"a,string" `
}
} { } ,
} ,
// PtrHeadIntZeroNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntZeroNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A int ` json:"a" `
}
} { A : new ( struct {
A int ` json:"a" `
} ) } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntZeroNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A int ` json:"a,omitempty" `
}
} { A : new ( struct {
A int ` json:"a,omitempty" `
} ) } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntZeroNotRootString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A int ` json:"a,string" `
}
} { A : new ( struct {
A int ` json:"a,string" `
} ) } ,
} ,
// PtrHeadIntNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A int ` json:"a" `
}
} { A : & ( struct {
A int ` json:"a" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } ) } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A int ` json:"a,omitempty" `
}
} { A : & ( struct {
A int ` json:"a,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } ) } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNotRootString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A int ` json:"a,string" `
}
} { A : & ( struct {
A int ` json:"a,string" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } ) } ,
2021-01-16 16:16:26 +03:00
} ,
// PtrHeadIntPtrNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A * int ` json:"a" `
}
} { A : & ( struct {
A * int ` json:"a" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } ) } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A * int ` json:"a,omitempty" `
}
} { A : & ( struct {
A * int ` json:"a,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } ) } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNotRootString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A * int ` json:"a,string" `
}
} { A : & ( struct {
A * int ` json:"a,string" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } ) } ,
2021-01-16 16:16:26 +03:00
} ,
// PtrHeadIntPtrNilNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A * int ` json:"a" `
}
} { A : & ( struct {
A * int ` json:"a" `
} { A : nil } ) } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A * int ` json:"a,omitempty" `
}
} { A : & ( struct {
A * int ` json:"a,omitempty" `
} { A : nil } ) } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilNotRootString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A * int ` json:"a,string" `
}
} { A : & ( struct {
A * int ` json:"a,string" `
} { A : nil } ) } ,
} ,
// PtrHeadIntNilNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A * int ` json:"a" `
}
} { A : nil } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A * int ` json:"a,omitempty" `
} ` json:",omitempty" `
} { A : nil } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilNotRootString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A * int ` json:"a,string" `
} ` json:",string" `
} { A : nil } ,
} ,
// HeadIntZeroMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "HeadIntZeroMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A int ` json:"a" `
}
B struct {
B int ` json:"b" `
}
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntZeroMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A int ` json:"a,omitempty" `
}
B struct {
B int ` json:"b,omitempty" `
}
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntZeroMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A int ` json:"a,string" `
}
B struct {
B int ` json:"b,string" `
}
} { } ,
} ,
// HeadIntMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "HeadIntMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A int ` json:"a" `
}
B struct {
B int ` json:"b" `
}
} { A : struct {
A int ` json:"a" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } , B : struct {
2021-01-16 16:16:26 +03:00
B int ` json:"b" `
} { B : 2 } } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A int ` json:"a,omitempty" `
}
B struct {
B int ` json:"b,omitempty" `
}
} { A : struct {
A int ` json:"a,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } , B : struct {
2021-01-16 16:16:26 +03:00
B int ` json:"b,omitempty" `
} { B : 2 } } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A int ` json:"a,string" `
}
B struct {
B int ` json:"b,string" `
}
} { A : struct {
A int ` json:"a,string" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } , B : struct {
2021-01-16 16:16:26 +03:00
B int ` json:"b,string" `
} { B : 2 } } ,
} ,
// HeadIntPtrMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * int ` json:"a" `
}
B struct {
B * int ` json:"b" `
}
} { A : struct {
A * int ` json:"a" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } , B : struct {
2021-01-16 16:16:26 +03:00
B * int ` json:"b" `
} { B : intptr ( 2 ) } } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * int ` json:"a,omitempty" `
}
B struct {
B * int ` json:"b,omitempty" `
}
} { A : struct {
A * int ` json:"a,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } , B : struct {
2021-01-16 16:16:26 +03:00
B * int ` json:"b,omitempty" `
} { B : intptr ( 2 ) } } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * int ` json:"a,string" `
}
B struct {
B * int ` json:"b,string" `
}
} { A : struct {
A * int ` json:"a,string" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } , B : struct {
2021-01-16 16:16:26 +03:00
B * int ` json:"b,string" `
} { B : intptr ( 2 ) } } ,
} ,
// HeadIntPtrNilMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNilMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * int ` json:"a" `
}
B struct {
B * int ` json:"b" `
}
} { A : struct {
A * int ` json:"a" `
} { A : nil } , B : struct {
B * int ` json:"b" `
} { B : nil } } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNilMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * int ` json:"a,omitempty" `
}
B struct {
B * int ` json:"b,omitempty" `
}
} { A : struct {
A * int ` json:"a,omitempty" `
} { A : nil } , B : struct {
B * int ` json:"b,omitempty" `
} { B : nil } } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "HeadIntPtrNilMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * int ` json:"a,string" `
}
B struct {
B * int ` json:"b,string" `
}
} { A : struct {
A * int ` json:"a,string" `
} { A : nil } , B : struct {
B * int ` json:"b,string" `
} { B : nil } } ,
} ,
// PtrHeadIntZeroMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntZeroMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A struct {
A int ` json:"a" `
}
B struct {
B int ` json:"b" `
}
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntZeroMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A struct {
A int ` json:"a,omitempty" `
}
B struct {
B int ` json:"b,omitempty" `
}
} { } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntZeroMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A struct {
A int ` json:"a,string" `
}
B struct {
B int ` json:"b,string" `
}
} { } ,
} ,
// PtrHeadIntMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A struct {
A int ` json:"a" `
}
B struct {
B int ` json:"b" `
}
} { A : struct {
A int ` json:"a" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } , B : struct {
2021-01-16 16:16:26 +03:00
B int ` json:"b" `
} { B : 2 } } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A struct {
A int ` json:"a,omitempty" `
}
B struct {
B int ` json:"b,omitempty" `
}
} { A : struct {
A int ` json:"a,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } , B : struct {
2021-01-16 16:16:26 +03:00
B int ` json:"b,omitempty" `
} { B : 2 } } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A struct {
A int ` json:"a,string" `
}
B struct {
B int ` json:"b,string" `
}
} { A : struct {
A int ` json:"a,string" `
2021-02-19 09:13:33 +03:00
} { A : - 1 } , B : struct {
2021-01-16 16:16:26 +03:00
B int ` json:"b,string" `
} { B : 2 } } ,
} ,
// PtrHeadIntPtrMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A * int ` json:"a" `
}
B * struct {
B * int ` json:"b" `
}
} { A : & ( struct {
A * int ` json:"a" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } ) , B : & ( struct {
2021-01-16 16:16:26 +03:00
B * int ` json:"b" `
} { B : intptr ( 2 ) } ) } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A * int ` json:"a,omitempty" `
}
B * struct {
B * int ` json:"b,omitempty" `
}
} { A : & ( struct {
A * int ` json:"a,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } ) , B : & ( struct {
2021-01-16 16:16:26 +03:00
B * int ` json:"b,omitempty" `
} { B : intptr ( 2 ) } ) } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A * int ` json:"a,string" `
}
B * struct {
B * int ` json:"b,string" `
}
} { A : & ( struct {
A * int ` json:"a,string" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) } ) , B : & ( struct {
2021-01-16 16:16:26 +03:00
B * int ` json:"b,string" `
} { B : intptr ( 2 ) } ) } ,
} ,
// PtrHeadIntPtrNilMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A * int ` json:"a" `
}
B * struct {
B * int ` json:"b" `
}
} { A : nil , B : nil } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A * int ` json:"a,omitempty" `
} ` json:",omitempty" `
B * struct {
B * int ` json:"b,omitempty" `
} ` json:",omitempty" `
} { A : nil , B : nil } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A * int ` json:"a,string" `
} ` json:",string" `
B * struct {
B * int ` json:"b,string" `
} ` json:",string" `
} { A : nil , B : nil } ,
} ,
// PtrHeadIntNilMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * struct {
A * int ` json:"a" `
}
B * struct {
B * int ` json:"b" `
}
} ) ( nil ) ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * struct {
A * int ` json:"a,omitempty" `
}
B * struct {
B * int ` json:"b,omitempty" `
}
} ) ( nil ) ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * struct {
A * int ` json:"a,string" `
}
B * struct {
B * int ` json:"b,string" `
}
} ) ( nil ) ,
} ,
// PtrHeadIntDoubleMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntDoubleMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A int ` json:"a" `
B int ` json:"b" `
}
B * struct {
A int ` json:"a" `
B int ` json:"b" `
}
} { A : & ( struct {
A int ` json:"a" `
B int ` json:"b" `
2021-02-19 09:13:33 +03:00
} { A : - 1 , B : 2 } ) , B : & ( struct {
2021-01-16 16:16:26 +03:00
A int ` json:"a" `
B int ` json:"b" `
} { A : 3 , B : 4 } ) } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntDoubleMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A int ` json:"a,omitempty" `
B int ` json:"b,omitempty" `
}
B * struct {
A int ` json:"a,omitempty" `
B int ` json:"b,omitempty" `
}
} { A : & ( struct {
A int ` json:"a,omitempty" `
B int ` json:"b,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : - 1 , B : 2 } ) , B : & ( struct {
2021-01-16 16:16:26 +03:00
A int ` json:"a,omitempty" `
B int ` json:"b,omitempty" `
} { A : 3 , B : 4 } ) } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntDoubleMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A int ` json:"a,string" `
B int ` json:"b,string" `
}
B * struct {
A int ` json:"a,string" `
B int ` json:"b,string" `
}
} { A : & ( struct {
A int ` json:"a,string" `
B int ` json:"b,string" `
2021-02-19 09:13:33 +03:00
} { A : - 1 , B : 2 } ) , B : & ( struct {
2021-01-16 16:16:26 +03:00
A int ` json:"a,string" `
B int ` json:"b,string" `
} { A : 3 , B : 4 } ) } ,
} ,
// PtrHeadIntNilDoubleMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilDoubleMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A int ` json:"a" `
B int ` json:"b" `
}
B * struct {
A int ` json:"a" `
B int ` json:"b" `
}
} { A : nil , B : nil } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilDoubleMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A int ` json:"a,omitempty" `
B int ` json:"b,omitempty" `
} ` json:",omitempty" `
B * struct {
A int ` json:"a,omitempty" `
B int ` json:"b,omitempty" `
} ` json:",omitempty" `
} { A : nil , B : nil } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilDoubleMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A int ` json:"a,string" `
B int ` json:"b,string" `
}
B * struct {
A int ` json:"a,string" `
B int ` json:"b,string" `
}
} { A : nil , B : nil } ,
} ,
// PtrHeadIntNilDoubleMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilDoubleMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * struct {
A int ` json:"a" `
B int ` json:"b" `
}
B * struct {
A int ` json:"a" `
B int ` json:"b" `
}
} ) ( nil ) ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilDoubleMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * struct {
A int ` json:"a,omitempty" `
B int ` json:"b,omitempty" `
}
B * struct {
A int ` json:"a,omitempty" `
B int ` json:"b,omitempty" `
}
} ) ( nil ) ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntNilDoubleMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * struct {
A int ` json:"a,string" `
B int ` json:"b,string" `
}
B * struct {
A int ` json:"a,string" `
B int ` json:"b,string" `
}
} ) ( nil ) ,
} ,
// PtrHeadIntPtrDoubleMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrDoubleMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A * int ` json:"a" `
B * int ` json:"b" `
}
B * struct {
A * int ` json:"a" `
B * int ` json:"b" `
}
} { A : & ( struct {
A * int ` json:"a" `
B * int ` json:"b" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) , B : intptr ( 2 ) } ) , B : & ( struct {
2021-01-16 16:16:26 +03:00
A * int ` json:"a" `
B * int ` json:"b" `
} { A : intptr ( 3 ) , B : intptr ( 4 ) } ) } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrDoubleMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A * int ` json:"a,omitempty" `
B * int ` json:"b,omitempty" `
}
B * struct {
A * int ` json:"a,omitempty" `
B * int ` json:"b,omitempty" `
}
} { A : & ( struct {
A * int ` json:"a,omitempty" `
B * int ` json:"b,omitempty" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) , B : intptr ( 2 ) } ) , B : & ( struct {
2021-01-16 16:16:26 +03:00
A * int ` json:"a,omitempty" `
B * int ` json:"b,omitempty" `
} { A : intptr ( 3 ) , B : intptr ( 4 ) } ) } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrDoubleMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A * int ` json:"a,string" `
B * int ` json:"b,string" `
}
B * struct {
A * int ` json:"a,string" `
B * int ` json:"b,string" `
}
} { A : & ( struct {
A * int ` json:"a,string" `
B * int ` json:"b,string" `
2021-02-19 09:13:33 +03:00
} { A : intptr ( - 1 ) , B : intptr ( 2 ) } ) , B : & ( struct {
2021-01-16 16:16:26 +03:00
A * int ` json:"a,string" `
B * int ` json:"b,string" `
} { A : intptr ( 3 ) , B : intptr ( 4 ) } ) } ,
} ,
// PtrHeadIntPtrNilDoubleMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilDoubleMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A * int ` json:"a" `
B * int ` json:"b" `
}
B * struct {
A * int ` json:"a" `
B * int ` json:"b" `
}
} { A : nil , B : nil } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilDoubleMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A * int ` json:"a,omitempty" `
B * int ` json:"b,omitempty" `
} ` json:",omitempty" `
B * struct {
A * int ` json:"a,omitempty" `
B * int ` json:"b,omitempty" `
} ` json:",omitempty" `
} { A : nil , B : nil } ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilDoubleMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A * int ` json:"a,string" `
B * int ` json:"b,string" `
}
B * struct {
A * int ` json:"a,string" `
B * int ` json:"b,string" `
}
} { A : nil , B : nil } ,
} ,
// PtrHeadIntPtrNilDoubleMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilDoubleMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * struct {
A * int ` json:"a" `
B * int ` json:"b" `
}
B * struct {
A * int ` json:"a" `
B * int ` json:"b" `
}
} ) ( nil ) ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilDoubleMultiFieldsNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * struct {
A * int ` json:"a,omitempty" `
B * int ` json:"b,omitempty" `
}
B * struct {
A * int ` json:"a,omitempty" `
B * int ` json:"b,omitempty" `
}
} ) ( nil ) ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrHeadIntPtrNilDoubleMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * struct {
A * int ` json:"a,string" `
B * int ` json:"b,string" `
}
B * struct {
A * int ` json:"a,string" `
B * int ` json:"b,string" `
}
} ) ( nil ) ,
} ,
// AnonymousHeadInt
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadInt" ,
2021-01-16 16:16:26 +03:00
data : struct {
structInt
B int ` json:"b" `
} {
2021-02-19 09:13:33 +03:00
structInt : structInt { A : - 1 } ,
2021-01-16 16:16:26 +03:00
B : 2 ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntOmitEmpty
B int ` json:"b,omitempty" `
} {
2021-02-19 09:13:33 +03:00
structIntOmitEmpty : structIntOmitEmpty { A : - 1 } ,
2021-01-16 16:16:26 +03:00
B : 2 ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntString" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntString
B int ` json:"b,string" `
} {
2021-02-19 09:13:33 +03:00
structIntString : structIntString { A : - 1 } ,
2021-01-16 16:16:26 +03:00
B : 2 ,
} ,
} ,
// PtrAnonymousHeadInt
{
2021-02-14 20:08:05 +03:00
name : "PtrAnonymousHeadInt" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structInt
B int ` json:"b" `
} {
2021-02-19 09:13:33 +03:00
structInt : & structInt { A : - 1 } ,
2021-01-16 16:16:26 +03:00
B : 2 ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrAnonymousHeadIntOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntOmitEmpty
B int ` json:"b,omitempty" `
} {
2021-02-19 09:13:33 +03:00
structIntOmitEmpty : & structIntOmitEmpty { A : - 1 } ,
2021-01-16 16:16:26 +03:00
B : 2 ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrAnonymousHeadIntString" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntString
B int ` json:"b,string" `
} {
2021-02-19 09:13:33 +03:00
structIntString : & structIntString { A : - 1 } ,
2021-01-16 16:16:26 +03:00
B : 2 ,
} ,
} ,
// NilPtrAnonymousHeadInt
{
2021-02-14 20:08:05 +03:00
name : "NilPtrAnonymousHeadInt" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structInt
B int ` json:"b" `
} {
structInt : nil ,
B : 2 ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "NilPtrAnonymousHeadIntOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntOmitEmpty
B int ` json:"b,omitempty" `
} {
structIntOmitEmpty : nil ,
B : 2 ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "NilPtrAnonymousHeadIntString" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntString
B int ` json:"b,string" `
} {
structIntString : nil ,
B : 2 ,
} ,
} ,
// AnonymousHeadIntPtr
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntPtr" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntPtr
B * int ` json:"b" `
} {
2021-02-19 09:13:33 +03:00
structIntPtr : structIntPtr { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
B : intptr ( 2 ) ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntPtrOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntPtrOmitEmpty
B * int ` json:"b,omitempty" `
} {
2021-02-19 09:13:33 +03:00
structIntPtrOmitEmpty : structIntPtrOmitEmpty { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
B : intptr ( 2 ) ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntPtrString" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntPtrString
B * int ` json:"b,string" `
} {
2021-02-19 09:13:33 +03:00
structIntPtrString : structIntPtrString { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
B : intptr ( 2 ) ,
} ,
} ,
// AnonymousHeadIntPtrNil
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntPtrNil" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntPtr
B * int ` json:"b" `
} {
structIntPtr : structIntPtr { A : nil } ,
B : intptr ( 2 ) ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntPtrNilOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntPtrOmitEmpty
B * int ` json:"b,omitempty" `
} {
structIntPtrOmitEmpty : structIntPtrOmitEmpty { A : nil } ,
B : intptr ( 2 ) ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntPtrNilString" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntPtrString
B * int ` json:"b,string" `
} {
structIntPtrString : structIntPtrString { A : nil } ,
B : intptr ( 2 ) ,
} ,
} ,
// PtrAnonymousHeadIntPtr
{
2021-02-14 20:08:05 +03:00
name : "PtrAnonymousHeadIntPtr" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntPtr
B * int ` json:"b" `
} {
2021-02-19 09:13:33 +03:00
structIntPtr : & structIntPtr { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
B : intptr ( 2 ) ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrAnonymousHeadIntPtrOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntPtrOmitEmpty
B * int ` json:"b,omitempty" `
} {
2021-02-19 09:13:33 +03:00
structIntPtrOmitEmpty : & structIntPtrOmitEmpty { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
B : intptr ( 2 ) ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrAnonymousHeadIntPtrString" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntPtrString
B * int ` json:"b,string" `
} {
2021-02-19 09:13:33 +03:00
structIntPtrString : & structIntPtrString { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
B : intptr ( 2 ) ,
} ,
} ,
// NilPtrAnonymousHeadIntPtr
{
2021-02-14 20:08:05 +03:00
name : "NilPtrAnonymousHeadIntPtr" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntPtr
B * int ` json:"b" `
} {
structIntPtr : nil ,
B : intptr ( 2 ) ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "NilPtrAnonymousHeadIntPtrOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntPtrOmitEmpty
B * int ` json:"b,omitempty" `
} {
structIntPtrOmitEmpty : nil ,
B : intptr ( 2 ) ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "NilPtrAnonymousHeadIntPtrString" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntPtrString
B * int ` json:"b,string" `
} {
structIntPtrString : nil ,
B : intptr ( 2 ) ,
} ,
} ,
// AnonymousHeadIntOnly
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntOnly" ,
2021-01-16 16:16:26 +03:00
data : struct {
structInt
} {
2021-02-19 09:13:33 +03:00
structInt : structInt { A : - 1 } ,
2021-01-16 16:16:26 +03:00
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntOnlyOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntOmitEmpty
} {
2021-02-19 09:13:33 +03:00
structIntOmitEmpty : structIntOmitEmpty { A : - 1 } ,
2021-01-16 16:16:26 +03:00
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntOnlyString" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntString
} {
2021-02-19 09:13:33 +03:00
structIntString : structIntString { A : - 1 } ,
2021-01-16 16:16:26 +03:00
} ,
} ,
// PtrAnonymousHeadIntOnly
{
2021-02-14 20:08:05 +03:00
name : "PtrAnonymousHeadIntOnly" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structInt
} {
2021-02-19 09:13:33 +03:00
structInt : & structInt { A : - 1 } ,
2021-01-16 16:16:26 +03:00
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrAnonymousHeadIntOnlyOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntOmitEmpty
} {
2021-02-19 09:13:33 +03:00
structIntOmitEmpty : & structIntOmitEmpty { A : - 1 } ,
2021-01-16 16:16:26 +03:00
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrAnonymousHeadIntOnlyString" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntString
} {
2021-02-19 09:13:33 +03:00
structIntString : & structIntString { A : - 1 } ,
2021-01-16 16:16:26 +03:00
} ,
} ,
// NilPtrAnonymousHeadIntOnly
{
2021-02-14 20:08:05 +03:00
name : "NilPtrAnonymousHeadIntOnly" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structInt
} {
structInt : nil ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "NilPtrAnonymousHeadIntOnlyOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntOmitEmpty
} {
structIntOmitEmpty : nil ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "NilPtrAnonymousHeadIntOnlyString" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntString
} {
structIntString : nil ,
} ,
} ,
// AnonymousHeadIntPtrOnly
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntPtrOnly" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntPtr
} {
2021-02-19 09:13:33 +03:00
structIntPtr : structIntPtr { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntPtrOnlyOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntPtrOmitEmpty
} {
2021-02-19 09:13:33 +03:00
structIntPtrOmitEmpty : structIntPtrOmitEmpty { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntPtrOnlyString" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntPtrString
} {
2021-02-19 09:13:33 +03:00
structIntPtrString : structIntPtrString { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
} ,
} ,
// AnonymousHeadIntPtrNilOnly
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntPtrNilOnly" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntPtr
} {
structIntPtr : structIntPtr { A : nil } ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntPtrNilOnlyOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntPtrOmitEmpty
} {
structIntPtrOmitEmpty : structIntPtrOmitEmpty { A : nil } ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "AnonymousHeadIntPtrNilOnlyString" ,
2021-01-16 16:16:26 +03:00
data : struct {
structIntPtrString
} {
structIntPtrString : structIntPtrString { A : nil } ,
} ,
} ,
// PtrAnonymousHeadIntPtrOnly
{
2021-02-14 20:08:05 +03:00
name : "PtrAnonymousHeadIntPtrOnly" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntPtr
} {
2021-02-19 09:13:33 +03:00
structIntPtr : & structIntPtr { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrAnonymousHeadIntPtrOnlyOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntPtrOmitEmpty
} {
2021-02-19 09:13:33 +03:00
structIntPtrOmitEmpty : & structIntPtrOmitEmpty { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "PtrAnonymousHeadIntPtrOnlyString" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntPtrString
} {
2021-02-19 09:13:33 +03:00
structIntPtrString : & structIntPtrString { A : intptr ( - 1 ) } ,
2021-01-16 16:16:26 +03:00
} ,
} ,
// NilPtrAnonymousHeadIntPtrOnly
{
2021-02-14 20:08:05 +03:00
name : "NilPtrAnonymousHeadIntPtrOnly" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntPtr
} {
structIntPtr : nil ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "NilPtrAnonymousHeadIntPtrOnlyOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntPtrOmitEmpty
} {
structIntPtrOmitEmpty : nil ,
} ,
} ,
{
2021-02-14 20:08:05 +03:00
name : "NilPtrAnonymousHeadIntPtrOnlyString" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structIntPtrString
} {
structIntPtrString : nil ,
} ,
} ,
}
for _ , test := range tests {
for _ , indent := range [ ] bool { true , false } {
for _ , htmlEscape := range [ ] bool { true , false } {
var buf bytes . Buffer
enc := json . NewEncoder ( & buf )
enc . SetEscapeHTML ( htmlEscape )
if indent {
enc . SetIndent ( "" , " " )
}
if err := enc . Encode ( test . data ) ; err != nil {
2021-03-11 13:29:35 +03:00
t . Fatalf ( "%s(htmlEscape:%v,indent:%v): %+v: %s" , test . name , htmlEscape , indent , test . data , err )
2021-01-16 16:16:26 +03:00
}
2021-01-19 08:01:43 +03:00
stdresult := encodeByEncodingJSON ( test . data , indent , htmlEscape )
if buf . String ( ) != stdresult {
2021-03-11 13:29:35 +03:00
t . Errorf ( "%s(htmlEscape:%v,indent:%v): doesn't compatible with encoding/json. expected %q but got %q" , test . name , htmlEscape , indent , stdresult , buf . String ( ) )
2021-01-19 08:01:43 +03:00
}
2021-01-16 16:16:26 +03:00
}
}
}
}