2021-01-16 16:16:26 +03:00
package json_test
import (
"bytes"
"testing"
"github.com/goccy/go-json"
)
func TestCoverString ( t * testing . T ) {
type structString struct {
A string ` json:"a" `
}
2021-01-20 18:22:20 +03:00
type structStringOmitEmpty struct {
A string ` json:"a,omitempty" `
}
type structStringString struct {
A string ` json:"a,string" `
}
2021-05-08 18:40:18 +03:00
type structStringStringOmitEmpty struct {
A string ` json:"a,string,omitempty" `
}
2021-01-20 18:22:20 +03:00
2021-01-16 16:16:26 +03:00
type structStringPtr struct {
A * string ` json:"a" `
}
2021-01-20 18:22:20 +03:00
type structStringPtrOmitEmpty struct {
A * string ` json:"a,omitempty" `
}
type structStringPtrString struct {
A * string ` json:"a,string" `
}
2021-05-08 18:40:18 +03:00
type structStringPtrStringOmitEmpty struct {
A * string ` json:"a,string,omitempty" `
}
2021-01-16 16:16:26 +03:00
tests := [ ] struct {
2021-01-22 12:19:54 +03:00
name string
data interface { }
2021-01-16 16:16:26 +03:00
} {
2021-03-30 13:37:19 +03:00
{
name : "PtrHeadStringComplicated" ,
data : & struct {
X * struct {
A string
B [ ] string
}
} { X : & struct {
A string
B [ ] string
} { A : "hello" , B : [ ] string { "a" , "b" } } } ,
} ,
2021-03-19 17:31:29 +03:00
{
name : "String" ,
data : string ( "a" ) ,
} ,
{
name : "StringPtr" ,
data : stringptr ( "a" ) ,
} ,
{
name : "StringPtr3" ,
data : stringptr3 ( "a" ) ,
} ,
{
name : "StringPtrNil" ,
data : ( * string ) ( nil ) ,
} ,
{
name : "StringPtr3Nil" ,
data : ( * * * string ) ( nil ) ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringZero
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringZero" ,
2021-01-16 16:16:26 +03:00
data : struct {
A string ` json:"a" `
} { } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringZeroOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A string ` json:"a,omitempty" `
} { } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringZeroString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A string ` json:"a,string" `
} { } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringZeroStringOmitEmpty" ,
data : struct {
A string ` json:"a,string,omitempty" `
} { } ,
} ,
2021-01-20 18:22:20 +03:00
// HeadString
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadString" ,
2021-01-16 16:16:26 +03:00
data : struct {
A string ` json:"a" `
} { A : "foo" } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A string ` json:"a,omitempty" `
} { A : "foo" } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A string ` json:"a,string" `
} { A : "foo" } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringStringOmitEmpty" ,
data : struct {
A string ` json:"a,string,omitempty" `
} { A : "foo" } ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringPtr
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtr" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * string ` json:"a" `
} { A : stringptr ( "foo" ) } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * string ` json:"a,omitempty" `
} { A : stringptr ( "foo" ) } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * string ` json:"a,string" `
} { A : stringptr ( "foo" ) } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringPtrStringOmitEmpty" ,
data : struct {
A * string ` json:"a,string,omitempty" `
} { A : stringptr ( "foo" ) } ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringPtrNil
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNil" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * string ` json:"a" `
} { A : nil } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNilOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * string ` json:"a,omitempty" `
} { A : nil } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNilString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * string ` json:"a,string" `
} { A : nil } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringPtrNilStringOmitEmpty" ,
data : struct {
A * string ` json:"a,string,omitempty" `
} { A : nil } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringZero
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringZero" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A string ` json:"a" `
} { } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringZeroOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A string ` json:"a,omitempty" `
} { } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringZeroString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A string ` json:"a,string" `
} { } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringZeroStringOmitEmpty" ,
data : & struct {
A string ` json:"a,string,omitempty" `
} { } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadString
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadString" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A string ` json:"a" `
} { A : "foo" } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A string ` json:"a,omitempty" `
} { A : "foo" } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A string ` json:"a,string" `
} { A : "foo" } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringStringOmitEmpty" ,
data : & struct {
A string ` json:"a,string,omitempty" `
} { A : "foo" } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringPtr
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtr" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * string ` json:"a" `
} { A : stringptr ( "foo" ) } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * string ` json:"a,omitempty" `
} { A : stringptr ( "foo" ) } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * string ` json:"a,string" `
} { A : stringptr ( "foo" ) } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringPtrStringOmitEmpty" ,
data : & struct {
A * string ` json:"a,string,omitempty" `
} { A : stringptr ( "foo" ) } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringPtrNil
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNil" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * string ` json:"a" `
} { A : nil } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * string ` json:"a,omitempty" `
} { A : nil } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * string ` json:"a,string" `
} { A : nil } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringPtrNilStringOmitEmpty" ,
data : & struct {
A * string ` json:"a,string,omitempty" `
} { A : nil } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringNil
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNil" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * string ` json:"a" `
} ) ( nil ) ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : ( * struct {
A * string ` json:"a,omitempty" `
} ) ( nil ) ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilString" ,
2021-01-20 18:22:20 +03:00
data : ( * struct {
A * string ` json:"a,string" `
} ) ( nil ) ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringNilStringOmitEmpty" ,
data : ( * struct {
A * string ` json:"a,string,omitempty" `
} ) ( nil ) ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringZeroMultiFields
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringZeroMultiFields" ,
2021-01-16 16:16:26 +03:00
data : struct {
A string ` json:"a" `
B string ` json:"b" `
2021-01-22 12:19:54 +03:00
C string ` json:"c" `
2021-01-16 16:16:26 +03:00
} { } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringZeroMultiFieldsOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A string ` json:"a,omitempty" `
B string ` json:"b,omitempty" `
2021-01-22 12:19:54 +03:00
C string ` json:"c,omitempty" `
2021-01-20 18:22:20 +03:00
} { } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringZeroMultiFieldsString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A string ` json:"a,string" `
B string ` json:"b,string" `
2021-01-22 12:19:54 +03:00
C string ` json:"c,string" `
2021-01-20 18:22:20 +03:00
} { } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringZeroMultiFieldsStringOmitEmpty" ,
data : struct {
A string ` json:"a,string,omitempty" `
B string ` json:"b,string,omitempty" `
C string ` json:"c,string,omitempty" `
} { } ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringMultiFields
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringMultiFields" ,
2021-01-16 16:16:26 +03:00
data : struct {
A string ` json:"a" `
B string ` json:"b" `
2021-01-22 12:19:54 +03:00
C string ` json:"c" `
} { A : "foo" , B : "bar" , C : "baz" } ,
2021-01-16 16:16:26 +03:00
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringMultiFieldsOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A string ` json:"a,omitempty" `
B string ` json:"b,omitempty" `
2021-01-22 12:19:54 +03:00
C string ` json:"c,omitempty" `
} { A : "foo" , B : "bar" , C : "baz" } ,
2021-01-20 18:22:20 +03:00
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringMultiFieldsString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A string ` json:"a,string" `
B string ` json:"b,string" `
2021-01-22 12:19:54 +03:00
C string ` json:"c,string" `
} { A : "foo" , B : "bar" , C : "baz" } ,
2021-01-20 18:22:20 +03:00
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringMultiFieldsStringOmitEmpty" ,
data : struct {
A string ` json:"a,string,omitempty" `
B string ` json:"b,string,omitempty" `
C string ` json:"c,string,omitempty" `
} { A : "foo" , B : "bar" , C : "baz" } ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringPtrMultiFields
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrMultiFields" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * string ` json:"a" `
B * string ` json:"b" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) , C : stringptr ( "baz" ) } ,
2021-01-16 16:16:26 +03:00
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrMultiFieldsOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * string ` json:"a,omitempty" `
B * string ` json:"b,omitempty" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c,omitempty" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) , C : stringptr ( "baz" ) } ,
2021-01-20 18:22:20 +03:00
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrMultiFieldsString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * string ` json:"a,string" `
B * string ` json:"b,string" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c,string" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) , C : stringptr ( "baz" ) } ,
2021-01-20 18:22:20 +03:00
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringPtrMultiFieldsStringOmitEmpty" ,
data : struct {
A * string ` json:"a,string,omitempty" `
B * string ` json:"b,string,omitempty" `
C * string ` json:"c,string,omitempty" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) , C : stringptr ( "baz" ) } ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringPtrNilMultiFields
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNilMultiFields" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * string ` json:"a" `
B * string ` json:"b" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c" `
} { A : nil , B : nil , C : nil } ,
2021-01-16 16:16:26 +03:00
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNilMultiFieldsOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * string ` json:"a,omitempty" `
B * string ` json:"b,omitempty" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c,omitempty" `
} { A : nil , B : nil , C : nil } ,
2021-01-20 18:22:20 +03:00
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNilMultiFieldsString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * string ` json:"a,string" `
B * string ` json:"b,string" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c,string" `
} { A : nil , B : nil , C : nil } ,
2021-01-20 18:22:20 +03:00
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringPtrNilMultiFieldsStringOmitEmpty" ,
data : struct {
A * string ` json:"a,string,omitempty" `
B * string ` json:"b,string,omitempty" `
C * string ` json:"c,string,omitempty" `
} { A : nil , B : nil , C : nil } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringZeroMultiFields
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringZeroMultiFields" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A string ` json:"a" `
B string ` json:"b" `
2021-01-22 12:19:54 +03:00
C string ` json:"c" `
2021-01-16 16:16:26 +03:00
} { } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringZeroMultiFieldsOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A string ` json:"a,omitempty" `
B string ` json:"b,omitempty" `
2021-01-22 12:19:54 +03:00
C string ` json:"c,omitempty" `
2021-01-20 18:22:20 +03:00
} { } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringZeroMultiFieldsString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A string ` json:"a,string" `
B string ` json:"b,string" `
2021-01-22 12:19:54 +03:00
C string ` json:"c,string" `
2021-01-20 18:22:20 +03:00
} { } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringZeroMultiFieldsStringOmitEmpty" ,
data : & struct {
A string ` json:"a,string,omitempty" `
B string ` json:"b,string,omitempty" `
C string ` json:"c,string,omitempty" `
} { } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringMultiFields
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringMultiFields" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A string ` json:"a" `
B string ` json:"b" `
2021-01-22 12:19:54 +03:00
C string ` json:"c" `
} { A : "foo" , B : "bar" , C : "baz" } ,
2021-01-16 16:16:26 +03:00
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringMultiFieldsOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A string ` json:"a,omitempty" `
B string ` json:"b,omitempty" `
2021-01-22 12:19:54 +03:00
C string ` json:"c,omitempty" `
} { A : "foo" , B : "bar" , C : "baz" } ,
2021-01-20 18:22:20 +03:00
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringMultiFieldsString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A string ` json:"a,string" `
B string ` json:"b,string" `
2021-01-22 12:19:54 +03:00
C string ` json:"c,string" `
} { A : "foo" , B : "bar" , C : "baz" } ,
2021-01-20 18:22:20 +03:00
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringMultiFieldsStringOmitEmpty" ,
data : & struct {
A string ` json:"a,string,omitempty" `
B string ` json:"b,string,omitempty" `
C string ` json:"c,string,omitempty" `
} { A : "foo" , B : "bar" , C : "baz" } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringPtrMultiFields
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrMultiFields" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * string ` json:"a" `
B * string ` json:"b" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) , C : stringptr ( "baz" ) } ,
2021-01-16 16:16:26 +03:00
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrMultiFieldsOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * string ` json:"a,omitempty" `
B * string ` json:"b,omitempty" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c,omitempty" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) , C : stringptr ( "baz" ) } ,
2021-01-20 18:22:20 +03:00
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrMultiFieldsString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * string ` json:"a,string" `
B * string ` json:"b,string" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c,string" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) , C : stringptr ( "baz" ) } ,
2021-01-20 18:22:20 +03:00
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringPtrMultiFieldsStringOmitEmpty" ,
data : & struct {
A * string ` json:"a,string,omitempty" `
B * string ` json:"b,string,omitempty" `
C * string ` json:"c,string,omitempty" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) , C : stringptr ( "baz" ) } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringPtrNilMultiFields
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilMultiFields" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * string ` json:"a" `
B * string ` json:"b" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c" `
} { A : nil , B : nil , C : nil } ,
2021-01-16 16:16:26 +03:00
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilMultiFieldsOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * string ` json:"a,omitempty" `
B * string ` json:"b,omitempty" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c,omitempty" `
} { A : nil , B : nil , C : nil } ,
2021-01-20 18:22:20 +03:00
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilMultiFieldsString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * string ` json:"a,string" `
B * string ` json:"b,string" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c,string" `
} { A : nil , B : nil , C : nil } ,
2021-01-20 18:22:20 +03:00
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringPtrNilMultiFieldsStringOmitEmpty" ,
data : & struct {
A * string ` json:"a,string,omitempty" `
B * string ` json:"b,string,omitempty" `
C * string ` json:"c,string,omitempty" `
} { A : nil , B : nil , C : nil } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringNilMultiFields
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilMultiFields" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * string ` json:"a" `
B * string ` json:"b" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c" `
2021-01-16 16:16:26 +03:00
} ) ( nil ) ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilMultiFieldsOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : ( * struct {
A * string ` json:"a,omitempty" `
B * string ` json:"b,omitempty" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c,omitempty" `
2021-01-20 18:22:20 +03:00
} ) ( nil ) ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilMultiFieldsString" ,
2021-01-20 18:22:20 +03:00
data : ( * struct {
A * string ` json:"a,string" `
B * string ` json:"b,string" `
2021-01-22 12:19:54 +03:00
C * string ` json:"c,string" `
2021-01-20 18:22:20 +03:00
} ) ( nil ) ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringNilMultiFieldsStringOmitEmpty" ,
data : ( * struct {
A * string ` json:"a,string,omitempty" `
B * string ` json:"b,string,omitempty" `
C * string ` json:"c,string,omitempty" `
} ) ( nil ) ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringZeroNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringZeroNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A string ` json:"a" `
}
} { } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringZeroNotRootOmitEmpty" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
2021-01-20 18:22:20 +03:00
A string ` json:"a,omitempty" `
2021-01-16 16:16:26 +03:00
}
2021-01-20 18:22:20 +03:00
} { } ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringZeroNotRootString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A string ` json:"a,string" `
}
} { } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringZeroNotRootStringOmitEmpty" ,
data : struct {
A struct {
A string ` json:"a,string,omitempty" `
}
} { } ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringNotRoot
{
2021-01-22 12:19:54 +03:00
name : "HeadStringNotRoot" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A string ` json:"a" `
}
} { A : struct {
A string ` json:"a" `
} { A : "foo" } } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A string ` json:"a,omitempty" `
}
} { A : struct {
A string ` json:"a,omitempty" `
} { A : "foo" } } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringNotRootString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A string ` json:"a,string" `
}
} { A : struct {
A string ` json:"a,string" `
} { A : "foo" } } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringNotRootStringOmitEmpty" ,
data : struct {
A struct {
A string ` json:"a,string,omitempty" `
}
} { A : struct {
A string ` json:"a,string,omitempty" `
} { A : "foo" } } ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringPtrNotRoot
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * string ` json:"a" `
}
} { A : struct {
A * string ` json:"a" `
} { stringptr ( "foo" ) } } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A * string ` json:"a,omitempty" `
}
} { A : struct {
A * string ` json:"a,omitempty" `
} { stringptr ( "foo" ) } } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNotRootString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A * string ` json:"a,string" `
}
} { A : struct {
A * string ` json:"a,string" `
} { stringptr ( "foo" ) } } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringPtrNotRootStringOmitEmpty" ,
data : struct {
A struct {
A * string ` json:"a,string,omitempty" `
}
} { A : struct {
A * string ` json:"a,string,omitempty" `
} { stringptr ( "foo" ) } } ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringPtrNilNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNilNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * string ` json:"a" `
}
} { } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNilNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A * string ` json:"a,omitempty" `
}
} { } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNilNotRootString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A * string ` json:"a,string" `
}
} { } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringPtrNilNotRootStringOmitEmpty" ,
data : struct {
A struct {
A * string ` json:"a,string,omitempty" `
}
} { } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringZeroNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringZeroNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A string ` json:"a" `
}
} { A : new ( struct {
A string ` json:"a" `
} ) } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringZeroNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * struct {
A string ` json:"a,omitempty" `
}
} { A : new ( struct {
A string ` json:"a,omitempty" `
} ) } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringZeroNotRootString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * struct {
A string ` json:"a,string" `
}
} { A : new ( struct {
A string ` json:"a,string" `
} ) } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringZeroNotRootStringOmitEmpty" ,
data : struct {
A * struct {
A string ` json:"a,string,omitempty" `
}
} { A : new ( struct {
A string ` json:"a,string,omitempty" `
} ) } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A string ` json:"a" `
}
} { A : & ( struct {
A string ` json:"a" `
} { A : "foo" } ) } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * struct {
A string ` json:"a,omitempty" `
}
} { A : & ( struct {
A string ` json:"a,omitempty" `
} { A : "foo" } ) } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNotRootString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * struct {
A string ` json:"a,string" `
}
} { A : & ( struct {
A string ` json:"a,string" `
} { A : "foo" } ) } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringNotRootStringOmitEmpty" ,
data : struct {
A * struct {
A string ` json:"a,string,omitempty" `
}
} { A : & ( struct {
A string ` json:"a,string,omitempty" `
} { A : "foo" } ) } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringPtrNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A * string ` json:"a" `
}
} { A : & ( struct {
A * string ` json:"a" `
} { A : stringptr ( "foo" ) } ) } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * struct {
A * string ` json:"a,omitempty" `
}
} { A : & ( struct {
A * string ` json:"a,omitempty" `
} { A : stringptr ( "foo" ) } ) } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNotRootString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * struct {
A * string ` json:"a,string" `
}
} { A : & ( struct {
A * string ` json:"a,string" `
} { A : stringptr ( "foo" ) } ) } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringPtrNotRootStringOmitEmpty" ,
data : struct {
A * struct {
A * string ` json:"a,string,omitempty" `
}
} { A : & ( struct {
A * string ` json:"a,string,omitempty" `
} { A : stringptr ( "foo" ) } ) } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringPtrNilNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A * string ` json:"a" `
}
} { A : & ( struct {
A * string ` json:"a" `
} { A : nil } ) } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * struct {
A * string ` json:"a,omitempty" `
}
} { A : & ( struct {
A * string ` json:"a,omitempty" `
} { A : nil } ) } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilNotRootString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * struct {
A * string ` json:"a,string" `
}
} { A : & ( struct {
A * string ` json:"a,string" `
} { A : nil } ) } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringPtrNilNotRootStringOmitEmpty" ,
data : struct {
A * struct {
A * string ` json:"a,string,omitempty" `
}
} { A : & ( struct {
A * string ` json:"a,string,omitempty" `
} { A : nil } ) } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringNilNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A * struct {
A * string ` json:"a" `
}
} { A : nil } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * struct {
A * string ` json:"a,omitempty" `
} ` json:",omitempty" `
} { A : nil } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilNotRootString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A * struct {
A * string ` json:"a,string" `
} ` json:",string" `
} { A : nil } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringNilNotRootStringOmitEmpty" ,
data : struct {
A * struct {
A * string ` json:"a,string,omitempty" `
} ` json:",string,omitempty" `
} { A : nil } ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringZeroMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringZeroMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A string ` json:"a" `
}
B struct {
B string ` json:"b" `
}
} { } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringZeroMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A string ` json:"a,omitempty" `
}
B struct {
B string ` json:"b,omitempty" `
}
} { } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringZeroMultiFieldsNotRootString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A string ` json:"a,string" `
}
B struct {
B string ` json:"b,string" `
}
} { } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringZeroMultiFieldsNotRootStringOmitEmpty" ,
data : struct {
A struct {
A string ` json:"a,string,omitempty" `
}
B struct {
B string ` json:"b,string,omitempty" `
}
} { } ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A string ` json:"a" `
}
B struct {
B string ` json:"b" `
}
} { A : struct {
A string ` json:"a" `
} { A : "foo" } , B : struct {
B string ` json:"b" `
} { B : "bar" } } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A string ` json:"a,omitempty" `
}
B struct {
B string ` json:"b,omitempty" `
}
} { A : struct {
A string ` json:"a,omitempty" `
} { A : "foo" } , B : struct {
B string ` json:"b,omitempty" `
} { B : "bar" } } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringMultiFieldsNotRootString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A string ` json:"a,string" `
}
B struct {
B string ` json:"b,string" `
}
} { A : struct {
A string ` json:"a,string" `
} { A : "foo" } , B : struct {
B string ` json:"b,string" `
} { B : "bar" } } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringMultiFieldsNotRootStringOmitEmpty" ,
data : struct {
A struct {
A string ` json:"a,string,omitempty" `
}
B struct {
B string ` json:"b,string,omitempty" `
}
} { A : struct {
A string ` json:"a,string,omitempty" `
} { A : "foo" } , B : struct {
B string ` json:"b,string,omitempty" `
} { B : "bar" } } ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringPtrMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * string ` json:"a" `
}
B struct {
B * string ` json:"b" `
}
} { A : struct {
A * string ` json:"a" `
} { A : stringptr ( "foo" ) } , B : struct {
B * string ` json:"b" `
} { B : stringptr ( "bar" ) } } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A * string ` json:"a,omitempty" `
}
B struct {
B * string ` json:"b,omitempty" `
}
} { A : struct {
A * string ` json:"a,omitempty" `
} { A : stringptr ( "foo" ) } , B : struct {
B * string ` json:"b,omitempty" `
} { B : stringptr ( "bar" ) } } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrMultiFieldsNotRootString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A * string ` json:"a,string" `
}
B struct {
B * string ` json:"b,string" `
}
} { A : struct {
A * string ` json:"a,string" `
} { A : stringptr ( "foo" ) } , B : struct {
B * string ` json:"b,string" `
} { B : stringptr ( "bar" ) } } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringPtrMultiFieldsNotRootStringOmitEmpty" ,
data : struct {
A struct {
A * string ` json:"a,string,omitempty" `
}
B struct {
B * string ` json:"b,string,omitempty" `
}
} { A : struct {
A * string ` json:"a,string,omitempty" `
} { A : stringptr ( "foo" ) } , B : struct {
B * string ` json:"b,string,omitempty" `
} { B : stringptr ( "bar" ) } } ,
} ,
2021-01-20 18:22:20 +03:00
// HeadStringPtrNilMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNilMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : struct {
A struct {
A * string ` json:"a" `
}
B struct {
B * string ` json:"b" `
}
} { A : struct {
A * string ` json:"a" `
} { A : nil } , B : struct {
B * string ` json:"b" `
} { B : nil } } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNilMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
2021-01-16 16:16:26 +03:00
A struct {
2021-01-20 18:22:20 +03:00
A * string ` json:"a,omitempty" `
2021-01-16 16:16:26 +03:00
}
B struct {
2021-01-20 18:22:20 +03:00
B * string ` json:"b,omitempty" `
2021-01-16 16:16:26 +03:00
}
2021-01-20 18:22:20 +03:00
} { A : struct {
A * string ` json:"a,omitempty" `
} { A : nil } , B : struct {
B * string ` json:"b,omitempty" `
} { B : nil } } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "HeadStringPtrNilMultiFieldsNotRootString" ,
2021-01-20 18:22:20 +03:00
data : struct {
A struct {
A * string ` json:"a,string" `
}
B struct {
B * string ` json:"b,string" `
}
} { A : struct {
A * string ` json:"a,string" `
} { A : nil } , B : struct {
B * string ` json:"b,string" `
} { B : nil } } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "HeadStringPtrNilMultiFieldsNotRootStringOmitEmpty" ,
data : struct {
A struct {
A * string ` json:"a,string,omitempty" `
}
B struct {
B * string ` json:"b,string,omitempty" `
}
} { A : struct {
A * string ` json:"a,string,omitempty" `
} { A : nil } , B : struct {
B * string ` json:"b,string,omitempty" `
} { B : nil } } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringZeroMultiFieldsNotRoot
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringZeroMultiFieldsNotRoot" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A struct {
A string ` json:"a" `
}
B struct {
B string ` json:"b" `
}
} { } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringZeroMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A struct {
A string ` json:"a,omitempty" `
}
B struct {
B string ` json:"b,omitempty" `
}
} { } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringZeroMultiFieldsNotRootString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A struct {
A string ` json:"a,string" `
}
B struct {
B string ` json:"b,string" `
}
} { } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringZeroMultiFieldsNotRootStringOmitEmpty" ,
data : & struct {
A struct {
A string ` json:"a,string,omitempty" `
}
B struct {
B string ` json:"b,string,omitempty" `
}
} { } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringMultiFieldsNotRoot
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A struct {
A string ` json:"a" `
}
B struct {
B string ` json:"b" `
}
} { A : struct {
A string ` json:"a" `
} { A : "foo" } , B : struct {
B string ` json:"b" `
} { B : "bar" } } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A struct {
A string ` json:"a,omitempty" `
}
B struct {
B string ` json:"b,omitempty" `
}
} { A : struct {
A string ` json:"a,omitempty" `
} { A : "foo" } , B : struct {
B string ` json:"b,omitempty" `
} { B : "bar" } } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringMultiFieldsNotRootString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A struct {
A string ` json:"a,string" `
}
B struct {
B string ` json:"b,string" `
}
} { A : struct {
A string ` json:"a,string" `
} { A : "foo" } , B : struct {
B string ` json:"b,string" `
} { B : "bar" } } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringMultiFieldsNotRootStringOmitEmpty" ,
data : & struct {
A struct {
A string ` json:"a,string,omitempty" `
}
B struct {
B string ` json:"b,string,omitempty" `
}
} { A : struct {
A string ` json:"a,string,omitempty" `
} { A : "foo" } , B : struct {
B string ` json:"b,string,omitempty" `
} { B : "bar" } } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringPtrMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A * string ` json:"a" `
}
B * struct {
B * string ` json:"b" `
}
} { A : & ( struct {
A * string ` json:"a" `
} { A : stringptr ( "foo" ) } ) , B : & ( struct {
B * string ` json:"b" `
} { B : stringptr ( "bar" ) } ) } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * struct {
A * string ` json:"a,omitempty" `
}
B * struct {
B * string ` json:"b,omitempty" `
}
} { A : & ( struct {
A * string ` json:"a,omitempty" `
} { A : stringptr ( "foo" ) } ) , B : & ( struct {
B * string ` json:"b,omitempty" `
} { B : stringptr ( "bar" ) } ) } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrMultiFieldsNotRootString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * struct {
A * string ` json:"a,string" `
}
B * struct {
B * string ` json:"b,string" `
}
} { A : & ( struct {
A * string ` json:"a,string" `
} { A : stringptr ( "foo" ) } ) , B : & ( struct {
B * string ` json:"b,string" `
} { B : stringptr ( "bar" ) } ) } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringPtrMultiFieldsNotRootStringOmitEmpty" ,
data : & struct {
A * struct {
A * string ` json:"a,string,omitempty" `
}
B * struct {
B * string ` json:"b,string,omitempty" `
}
} { A : & ( struct {
A * string ` json:"a,string,omitempty" `
} { A : stringptr ( "foo" ) } ) , B : & ( struct {
B * string ` json:"b,string,omitempty" `
} { B : stringptr ( "bar" ) } ) } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringPtrNilMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A * string ` json:"a" `
}
B * struct {
B * string ` json:"b" `
}
} { A : nil , B : nil } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * struct {
A * string ` json:"a,omitempty" `
}
B * struct {
B * string ` json:"b,omitempty" `
}
} { A : nil , B : nil } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilMultiFieldsNotRootString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * struct {
A * string ` json:"a,string" `
}
B * struct {
B * string ` json:"b,string" `
}
} { A : nil , B : nil } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringPtrNilMultiFieldsNotRootStringOmitEmpty" ,
data : & struct {
A * struct {
A * string ` json:"a,string,omitempty" `
}
B * struct {
B * string ` json:"b,string,omitempty" `
}
} { A : nil , B : nil } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringNilMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * struct {
A * string ` json:"a" `
}
B * struct {
B * string ` json:"b" `
}
} ) ( nil ) ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : ( * struct {
A * struct {
A * string ` json:"a,omitempty" `
}
B * struct {
B * string ` json:"b,omitempty" `
}
} ) ( nil ) ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilMultiFieldsNotRootString" ,
2021-01-20 18:22:20 +03:00
data : ( * struct {
A * struct {
A * string ` json:"a,string" `
}
B * struct {
B * string ` json:"b,string" `
}
} ) ( nil ) ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringNilMultiFieldsNotRootStringOmitEmpty" ,
data : ( * struct {
A * struct {
A * string ` json:"a,string,omitempty" `
}
B * struct {
B * string ` json:"b,string,omitempty" `
}
} ) ( nil ) ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringDoubleMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A string ` json:"a" `
B string ` json:"b" `
2021-01-22 12:19:54 +03:00
C string ` json:"c" `
2021-01-16 16:16:26 +03:00
}
B * struct {
A string ` json:"a" `
B string ` json:"b" `
2021-01-22 12:19:54 +03:00
C string ` json:"c" `
2021-01-16 16:16:26 +03:00
}
} { A : & ( struct {
A string ` json:"a" `
B string ` json:"b" `
2021-01-22 12:19:54 +03:00
C string ` json:"c" `
} { A : "foo" , B : "bar" , C : "baz" } ) , B : & ( struct {
2021-01-16 16:16:26 +03:00
A string ` json:"a" `
B string ` json:"b" `
2021-01-22 12:19:54 +03:00
C string ` json:"c" `
} { A : "foo" , B : "bar" , C : "baz" } ) } ,
2021-01-16 16:16:26 +03:00
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringDoubleMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * struct {
A string ` json:"a,omitempty" `
B string ` json:"b,omitempty" `
}
B * struct {
A string ` json:"a,omitempty" `
B string ` json:"b,omitempty" `
}
} { A : & ( struct {
A string ` json:"a,omitempty" `
B string ` json:"b,omitempty" `
} { A : "foo" , B : "bar" } ) , B : & ( struct {
A string ` json:"a,omitempty" `
B string ` json:"b,omitempty" `
} { A : "foo" , B : "bar" } ) } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringDoubleMultiFieldsNotRootString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * struct {
A string ` json:"a,string" `
B string ` json:"b,string" `
}
B * struct {
A string ` json:"a,string" `
B string ` json:"b,string" `
}
} { A : & ( struct {
A string ` json:"a,string" `
B string ` json:"b,string" `
} { A : "foo" , B : "bar" } ) , B : & ( struct {
A string ` json:"a,string" `
B string ` json:"b,string" `
} { A : "foo" , B : "bar" } ) } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringDoubleMultiFieldsNotRootStringOmitEmpty" ,
data : & struct {
A * struct {
A string ` json:"a,string,omitempty" `
B string ` json:"b,string,omitempty" `
}
B * struct {
A string ` json:"a,string,omitempty" `
B string ` json:"b,string,omitempty" `
}
} { A : & ( struct {
A string ` json:"a,string,omitempty" `
B string ` json:"b,string,omitempty" `
} { A : "foo" , B : "bar" } ) , B : & ( struct {
A string ` json:"a,string,omitempty" `
B string ` json:"b,string,omitempty" `
} { A : "foo" , B : "bar" } ) } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilDoubleMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : & struct {
A * struct {
A string ` json:"a" `
B string ` json:"b" `
}
B * struct {
A string ` json:"a" `
B string ` json:"b" `
}
} { A : nil , B : nil } ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilDoubleMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * struct {
A string ` json:"a,omitempty" `
B string ` json:"b,omitempty" `
}
B * struct {
A string ` json:"a,omitempty" `
B string ` json:"b,omitempty" `
}
} { A : nil , B : nil } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilDoubleMultiFieldsNotRootString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * struct {
A string ` json:"a,string" `
B string ` json:"b,string" `
}
B * struct {
A string ` json:"a,string" `
B string ` json:"b,string" `
}
} { A : nil , B : nil } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringNilDoubleMultiFieldsNotRootStringOmitEmpty" ,
data : & struct {
A * struct {
A string ` json:"a,string,omitempty" `
B string ` json:"b,string,omitempty" `
}
B * struct {
A string ` json:"a,string,omitempty" `
B string ` json:"b,string,omitempty" `
}
} { A : nil , B : nil } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilDoubleMultiFieldsNotRoot" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * struct {
A string ` json:"a" `
B string ` json:"b" `
}
B * struct {
2021-01-20 18:22:20 +03:00
A string ` json:"a" `
B string ` json:"b" `
}
} ) ( nil ) ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilDoubleMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : ( * struct {
A * struct {
A string ` json:"a,omitempty" `
B string ` json:"b,omitempty" `
}
B * struct {
A string ` json:"a,omitempty" `
B string ` json:"b,omitempty" `
}
} ) ( nil ) ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringNilDoubleMultiFieldsNotRootString" ,
2021-01-20 18:22:20 +03:00
data : ( * struct {
A * struct {
A string ` json:"a,string" `
B string ` json:"b,string" `
}
B * struct {
A string ` json:"a,string" `
B string ` json:"b,string" `
}
} ) ( nil ) ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringNilDoubleMultiFieldsNotRootStringOmitEmpty" ,
data : ( * struct {
A * struct {
A string ` json:"a,string,omitempty" `
B string ` json:"b,string,omitempty" `
}
B * struct {
A string ` json:"a,string,omitempty" `
B string ` json:"b,string,omitempty" `
}
} ) ( nil ) ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringPtrDoubleMultiFieldsNotRoot
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrDoubleMultiFieldsNotRoot" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * struct {
A * string ` json:"a" `
B * string ` json:"b" `
}
B * struct {
A * string ` json:"a" `
B * string ` json:"b" `
}
} { A : & ( struct {
A * string ` json:"a" `
B * string ` json:"b" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) } ) , B : & ( struct {
A * string ` json:"a" `
B * string ` json:"b" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) } ) } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrDoubleMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * struct {
A * string ` json:"a,omitempty" `
B * string ` json:"b,omitempty" `
}
B * struct {
A * string ` json:"a,omitempty" `
B * string ` json:"b,omitempty" `
}
} { A : & ( struct {
A * string ` json:"a,omitempty" `
B * string ` json:"b,omitempty" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) } ) , B : & ( struct {
A * string ` json:"a,omitempty" `
B * string ` json:"b,omitempty" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) } ) } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrDoubleMultiFieldsNotRootString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * struct {
A * string ` json:"a,string" `
B * string ` json:"b,string" `
}
B * struct {
A * string ` json:"a,string" `
B * string ` json:"b,string" `
}
} { A : & ( struct {
A * string ` json:"a,string" `
B * string ` json:"b,string" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) } ) , B : & ( struct {
A * string ` json:"a,string" `
B * string ` json:"b,string" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) } ) } ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringPtrDoubleMultiFieldsNotRootStringOmitEmpty" ,
data : & struct {
A * struct {
A * string ` json:"a,string,omitempty" `
B * string ` json:"b,string,omitempty" `
}
B * struct {
A * string ` json:"a,string,omitempty" `
B * string ` json:"b,string,omitempty" `
}
} { A : & ( struct {
A * string ` json:"a,string,omitempty" `
B * string ` json:"b,string,omitempty" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) } ) , B : & ( struct {
A * string ` json:"a,string,omitempty" `
B * string ` json:"b,string,omitempty" `
} { A : stringptr ( "foo" ) , B : stringptr ( "bar" ) } ) } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringPtrNilDoubleMultiFieldsNotRoot
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilDoubleMultiFieldsNotRoot" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * struct {
A * string ` json:"a" `
B * string ` json:"b" `
}
B * struct {
A * string ` json:"a" `
B * string ` json:"b" `
}
} { A : nil , B : nil } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilDoubleMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * struct {
A * string ` json:"a,omitempty" `
B * string ` json:"b,omitempty" `
}
B * struct {
A * string ` json:"a,omitempty" `
B * string ` json:"b,omitempty" `
}
} { A : nil , B : nil } ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilDoubleMultiFieldsNotRootString" ,
2021-01-20 18:22:20 +03:00
data : & struct {
A * struct {
A * string ` json:"a,string" `
B * string ` json:"b,string" `
}
B * struct {
A * string ` json:"a,string" `
B * string ` json:"b,string" `
2021-01-16 16:16:26 +03:00
}
2021-01-20 18:22:20 +03:00
} { A : nil , B : nil } ,
2021-01-16 16:16:26 +03:00
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringPtrNilDoubleMultiFieldsNotRootStringOmitEmpty" ,
data : & struct {
A * struct {
A * string ` json:"a,string,omitempty" `
B * string ` json:"b,string,omitempty" `
}
B * struct {
A * string ` json:"a,string,omitempty" `
B * string ` json:"b,string,omitempty" `
}
} { A : nil , B : nil } ,
} ,
2021-01-20 18:22:20 +03:00
// PtrHeadStringPtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilDoubleMultiFieldsNotRoot" ,
2021-01-20 18:22:20 +03:00
data : ( * struct {
2021-01-16 16:16:26 +03:00
A * struct {
A * string ` json:"a" `
B * string ` json:"b" `
}
B * struct {
A * string ` json:"a" `
B * string ` json:"b" `
}
2021-01-20 18:22:20 +03:00
} ) ( nil ) ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilDoubleMultiFieldsNotRootOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : ( * struct {
2021-01-16 16:16:26 +03:00
A * struct {
2021-01-20 18:22:20 +03:00
A * string ` json:"a,omitempty" `
B * string ` json:"b,omitempty" `
2021-01-16 16:16:26 +03:00
}
B * struct {
2021-01-20 18:22:20 +03:00
A * string ` json:"a,omitempty" `
B * string ` json:"b,omitempty" `
2021-01-16 16:16:26 +03:00
}
2021-01-20 18:22:20 +03:00
} ) ( nil ) ,
2021-01-16 16:16:26 +03:00
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrHeadStringPtrNilDoubleMultiFieldsNotRootString" ,
2021-01-16 16:16:26 +03:00
data : ( * struct {
A * struct {
2021-01-20 18:22:20 +03:00
A * string ` json:"a,string" `
B * string ` json:"b,string" `
2021-01-16 16:16:26 +03:00
}
B * struct {
2021-01-20 18:22:20 +03:00
A * string ` json:"a,string" `
B * string ` json:"b,string" `
2021-01-16 16:16:26 +03:00
}
} ) ( nil ) ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrHeadStringPtrNilDoubleMultiFieldsNotRootStringOmitEmpty" ,
data : ( * struct {
A * struct {
A * string ` json:"a,string,omitempty" `
B * string ` json:"b,string,omitempty" `
}
B * struct {
A * string ` json:"a,string,omitempty" `
B * string ` json:"b,string,omitempty" `
}
} ) ( nil ) ,
} ,
2021-01-20 18:22:20 +03:00
// AnonymousHeadString
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadString" ,
2021-01-16 16:16:26 +03:00
data : struct {
structString
B string ` json:"b" `
} {
structString : structString { A : "foo" } ,
B : "bar" ,
} ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
structStringOmitEmpty
B string ` json:"b,omitempty" `
} {
structStringOmitEmpty : structStringOmitEmpty { A : "foo" } ,
B : "bar" ,
} ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringString" ,
2021-01-20 18:22:20 +03:00
data : struct {
structStringString
B string ` json:"b,string" `
} {
structStringString : structStringString { A : "foo" } ,
B : "bar" ,
} ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "AnonymousHeadStringStringOmitEmpty" ,
data : struct {
structStringStringOmitEmpty
B string ` json:"b,string,omitempty" `
} {
structStringStringOmitEmpty : structStringStringOmitEmpty { A : "foo" } ,
B : "bar" ,
} ,
} ,
2021-01-20 18:22:20 +03:00
// PtrAnonymousHeadString
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrAnonymousHeadString" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structString
B string ` json:"b" `
} {
structString : & structString { A : "foo" } ,
B : "bar" ,
} ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrAnonymousHeadStringOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringOmitEmpty
B string ` json:"b,omitempty" `
} {
structStringOmitEmpty : & structStringOmitEmpty { A : "foo" } ,
B : "bar" ,
} ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrAnonymousHeadStringString" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringString
B string ` json:"b,string" `
} {
structStringString : & structStringString { A : "foo" } ,
B : "bar" ,
} ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrAnonymousHeadStringStringOmitEmpty" ,
data : struct {
* structStringStringOmitEmpty
B string ` json:"b,string,omitempty" `
} {
structStringStringOmitEmpty : & structStringStringOmitEmpty { A : "foo" } ,
B : "bar" ,
} ,
} ,
2021-01-20 18:22:20 +03:00
// NilPtrAnonymousHeadString
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "NilPtrAnonymousHeadString" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structString
B string ` json:"b" `
} {
structString : nil ,
B : "baz" ,
} ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "NilPtrAnonymousHeadStringOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringOmitEmpty
B string ` json:"b,omitempty" `
} {
structStringOmitEmpty : nil ,
B : "baz" ,
} ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "NilPtrAnonymousHeadStringString" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringString
B string ` json:"b,string" `
} {
structStringString : nil ,
B : "baz" ,
} ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "NilPtrAnonymousHeadStringStringOmitEmpty" ,
data : struct {
* structStringStringOmitEmpty
B string ` json:"b,string,omitempty" `
} {
structStringStringOmitEmpty : nil ,
B : "baz" ,
} ,
} ,
2021-01-20 18:22:20 +03:00
// AnonymousHeadStringPtr
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringPtr" ,
2021-01-16 16:16:26 +03:00
data : struct {
structStringPtr
B * string ` json:"b" `
} {
structStringPtr : structStringPtr { A : stringptr ( "foo" ) } ,
B : stringptr ( "bar" ) ,
} ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringPtrOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
structStringPtrOmitEmpty
B * string ` json:"b,omitempty" `
} {
structStringPtrOmitEmpty : structStringPtrOmitEmpty { A : stringptr ( "foo" ) } ,
B : stringptr ( "bar" ) ,
} ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringPtrString" ,
2021-01-20 18:22:20 +03:00
data : struct {
structStringPtrString
B * string ` json:"b,string" `
} {
structStringPtrString : structStringPtrString { A : stringptr ( "foo" ) } ,
B : stringptr ( "bar" ) ,
} ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "AnonymousHeadStringPtrStringOmitEmpty" ,
data : struct {
structStringPtrStringOmitEmpty
B * string ` json:"b,string,omitempty" `
} {
structStringPtrStringOmitEmpty : structStringPtrStringOmitEmpty { A : stringptr ( "foo" ) } ,
B : stringptr ( "bar" ) ,
} ,
} ,
2021-01-20 18:22:20 +03:00
// AnonymousHeadStringPtrNil
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringPtrNil" ,
2021-01-16 16:16:26 +03:00
data : struct {
structStringPtr
B * string ` json:"b" `
} {
structStringPtr : structStringPtr { A : nil } ,
B : stringptr ( "foo" ) ,
} ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringPtrNilOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
structStringPtrOmitEmpty
B * string ` json:"b,omitempty" `
} {
structStringPtrOmitEmpty : structStringPtrOmitEmpty { A : nil } ,
B : stringptr ( "foo" ) ,
} ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringPtrNilString" ,
2021-01-20 18:22:20 +03:00
data : struct {
structStringPtrString
B * string ` json:"b,string" `
} {
structStringPtrString : structStringPtrString { A : nil } ,
B : stringptr ( "foo" ) ,
} ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "AnonymousHeadStringPtrNilStringOmitEmpty" ,
data : struct {
structStringPtrStringOmitEmpty
B * string ` json:"b,string,omitempty" `
} {
structStringPtrStringOmitEmpty : structStringPtrStringOmitEmpty { A : nil } ,
B : stringptr ( "foo" ) ,
} ,
} ,
2021-01-20 18:22:20 +03:00
// PtrAnonymousHeadStringPtr
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrAnonymousHeadStringPtr" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structStringPtr
B * string ` json:"b" `
} {
structStringPtr : & structStringPtr { A : stringptr ( "foo" ) } ,
B : stringptr ( "bar" ) ,
} ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrAnonymousHeadStringPtrOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringPtrOmitEmpty
B * string ` json:"b,omitempty" `
} {
structStringPtrOmitEmpty : & structStringPtrOmitEmpty { A : stringptr ( "foo" ) } ,
B : stringptr ( "bar" ) ,
} ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrAnonymousHeadStringPtrString" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringPtrString
B * string ` json:"b,string" `
} {
structStringPtrString : & structStringPtrString { A : stringptr ( "foo" ) } ,
B : stringptr ( "bar" ) ,
} ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrAnonymousHeadStringPtrStringOmitEmpty" ,
data : struct {
* structStringPtrStringOmitEmpty
B * string ` json:"b,string,omitempty" `
} {
structStringPtrStringOmitEmpty : & structStringPtrStringOmitEmpty { A : stringptr ( "foo" ) } ,
B : stringptr ( "bar" ) ,
} ,
} ,
2021-01-20 18:22:20 +03:00
// NilPtrAnonymousHeadStringPtr
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "NilPtrAnonymousHeadStringPtr" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structStringPtr
B * string ` json:"b" `
} {
structStringPtr : nil ,
B : stringptr ( "foo" ) ,
} ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "NilPtrAnonymousHeadStringPtrOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringPtrOmitEmpty
B * string ` json:"b,omitempty" `
} {
structStringPtrOmitEmpty : nil ,
B : stringptr ( "foo" ) ,
} ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "NilPtrAnonymousHeadStringPtrString" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringPtrString
B * string ` json:"b,string" `
} {
structStringPtrString : nil ,
B : stringptr ( "foo" ) ,
} ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "NilPtrAnonymousHeadStringPtrStringOmitEmpty" ,
data : struct {
* structStringPtrStringOmitEmpty
B * string ` json:"b,string,omitempty" `
} {
structStringPtrStringOmitEmpty : nil ,
B : stringptr ( "foo" ) ,
} ,
} ,
2021-01-20 18:22:20 +03:00
// AnonymousHeadStringOnly
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringOnly" ,
2021-01-16 16:16:26 +03:00
data : struct {
structString
} {
structString : structString { A : "foo" } ,
} ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringOnlyOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
structStringOmitEmpty
} {
structStringOmitEmpty : structStringOmitEmpty { A : "foo" } ,
} ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringOnlyString" ,
2021-01-20 18:22:20 +03:00
data : struct {
structStringString
} {
structStringString : structStringString { A : "foo" } ,
} ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "AnonymousHeadStringOnlyStringOmitEmpty" ,
data : struct {
structStringStringOmitEmpty
} {
structStringStringOmitEmpty : structStringStringOmitEmpty { A : "foo" } ,
} ,
} ,
2021-01-20 18:22:20 +03:00
// PtrAnonymousHeadStringOnly
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrAnonymousHeadStringOnly" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structString
} {
structString : & structString { A : "foo" } ,
} ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrAnonymousHeadStringOnlyOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringOmitEmpty
} {
structStringOmitEmpty : & structStringOmitEmpty { A : "foo" } ,
} ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrAnonymousHeadStringOnlyString" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringString
} {
structStringString : & structStringString { A : "foo" } ,
} ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrAnonymousHeadStringOnlyStringOmitEmpty" ,
data : struct {
* structStringStringOmitEmpty
} {
structStringStringOmitEmpty : & structStringStringOmitEmpty { A : "foo" } ,
} ,
} ,
2021-01-20 18:22:20 +03:00
// NilPtrAnonymousHeadStringOnly
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "NilPtrAnonymousHeadStringOnly" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structString
} {
structString : nil ,
} ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "NilPtrAnonymousHeadStringOnlyOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringOmitEmpty
} {
structStringOmitEmpty : nil ,
} ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "NilPtrAnonymousHeadStringOnlyString" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringString
} {
structStringString : nil ,
} ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "NilPtrAnonymousHeadStringOnlyStringOmitEmpty" ,
data : struct {
* structStringStringOmitEmpty
} {
structStringStringOmitEmpty : nil ,
} ,
} ,
2021-01-20 18:22:20 +03:00
// AnonymousHeadStringPtrOnly
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringPtrOnly" ,
2021-01-16 16:16:26 +03:00
data : struct {
structStringPtr
} {
structStringPtr : structStringPtr { A : stringptr ( "foo" ) } ,
} ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringPtrOnlyOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
structStringPtrOmitEmpty
} {
structStringPtrOmitEmpty : structStringPtrOmitEmpty { A : stringptr ( "foo" ) } ,
} ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringPtrOnlyString" ,
2021-01-20 18:22:20 +03:00
data : struct {
structStringPtrString
} {
structStringPtrString : structStringPtrString { A : stringptr ( "foo" ) } ,
} ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "AnonymousHeadStringPtrOnlyStringOmitEmpty" ,
data : struct {
structStringPtrStringOmitEmpty
} {
structStringPtrStringOmitEmpty : structStringPtrStringOmitEmpty { A : stringptr ( "foo" ) } ,
} ,
} ,
2021-01-20 18:22:20 +03:00
// AnonymousHeadStringPtrNilOnly
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringPtrNilOnly" ,
2021-01-16 16:16:26 +03:00
data : struct {
structStringPtr
} {
structStringPtr : structStringPtr { A : nil } ,
} ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringPtrNilOnlyOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
structStringPtrOmitEmpty
} {
structStringPtrOmitEmpty : structStringPtrOmitEmpty { A : nil } ,
} ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "AnonymousHeadStringPtrNilOnlyString" ,
2021-01-20 18:22:20 +03:00
data : struct {
structStringPtrString
} {
structStringPtrString : structStringPtrString { A : nil } ,
} ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "AnonymousHeadStringPtrNilOnlyStringOmitEmpty" ,
data : struct {
structStringPtrStringOmitEmpty
} {
structStringPtrStringOmitEmpty : structStringPtrStringOmitEmpty { A : nil } ,
} ,
} ,
2021-01-20 18:22:20 +03:00
// PtrAnonymousHeadStringPtrOnly
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrAnonymousHeadStringPtrOnly" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structStringPtr
} {
structStringPtr : & structStringPtr { A : stringptr ( "foo" ) } ,
} ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "PtrAnonymousHeadStringPtrOnlyOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringPtrOmitEmpty
} {
structStringPtrOmitEmpty : & structStringPtrOmitEmpty { A : stringptr ( "foo" ) } ,
} ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "PtrAnonymousHeadStringPtrOnlyString" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringPtrString
} {
structStringPtrString : & structStringPtrString { A : stringptr ( "foo" ) } ,
} ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "PtrAnonymousHeadStringPtrOnlyStringOmitEmpty" ,
data : struct {
* structStringPtrStringOmitEmpty
} {
structStringPtrStringOmitEmpty : & structStringPtrStringOmitEmpty { A : stringptr ( "foo" ) } ,
} ,
} ,
2021-01-20 18:22:20 +03:00
// NilPtrAnonymousHeadStringPtrOnly
2021-01-16 16:16:26 +03:00
{
2021-01-22 12:19:54 +03:00
name : "NilPtrAnonymousHeadStringPtrOnly" ,
2021-01-16 16:16:26 +03:00
data : struct {
* structStringPtr
} {
structStringPtr : nil ,
} ,
} ,
2021-01-20 18:22:20 +03:00
{
2021-01-22 12:19:54 +03:00
name : "NilPtrAnonymousHeadStringPtrOnlyOmitEmpty" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringPtrOmitEmpty
} {
structStringPtrOmitEmpty : nil ,
} ,
} ,
{
2021-01-22 12:19:54 +03:00
name : "NilPtrAnonymousHeadStringPtrOnlyString" ,
2021-01-20 18:22:20 +03:00
data : struct {
* structStringPtrString
} {
structStringPtrString : nil ,
} ,
} ,
2021-05-08 18:40:18 +03:00
{
name : "NilPtrAnonymousHeadStringPtrOnlyStringOmitEmpty" ,
data : struct {
* structStringPtrStringOmitEmpty
} {
structStringPtrStringOmitEmpty : nil ,
} ,
} ,
2021-01-16 16:16:26 +03:00
}
for _ , test := range tests {
2021-01-20 18:22:20 +03:00
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-20 18:22:20 +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-20 18:22:20 +03:00
}
2021-01-16 16:16:26 +03:00
}
}
}
}