github.com/goccy/go-json@v0.10.3-0.20240509105655-5e2ae3f23c1d/test/cover/cover_string_test.go (about)

     1  package json_test
     2  
     3  import (
     4  	"bytes"
     5  	"fmt"
     6  	"testing"
     7  
     8  	"github.com/goccy/go-json"
     9  )
    10  
    11  func TestCoverString(t *testing.T) {
    12  	type structString struct {
    13  		A string `json:"a"`
    14  	}
    15  	type structStringOmitEmpty struct {
    16  		A string `json:"a,omitempty"`
    17  	}
    18  	type structStringString struct {
    19  		A string `json:"a,string"`
    20  	}
    21  	type structStringStringOmitEmpty struct {
    22  		A string `json:"a,string,omitempty"`
    23  	}
    24  
    25  	type structStringPtr struct {
    26  		A *string `json:"a"`
    27  	}
    28  	type structStringPtrOmitEmpty struct {
    29  		A *string `json:"a,omitempty"`
    30  	}
    31  	type structStringPtrString struct {
    32  		A *string `json:"a,string"`
    33  	}
    34  	type structStringPtrStringOmitEmpty struct {
    35  		A *string `json:"a,string,omitempty"`
    36  	}
    37  
    38  	tests := []struct {
    39  		name string
    40  		data interface{}
    41  	}{
    42  		{
    43  			name: "PtrHeadStringComplicated",
    44  			data: &struct {
    45  				X *struct {
    46  					A string
    47  					B []string
    48  				}
    49  			}{X: &struct {
    50  				A string
    51  				B []string
    52  			}{A: "hello", B: []string{"a", "b"}}},
    53  		},
    54  		{
    55  			name: "String",
    56  			data: string("a"),
    57  		},
    58  		{
    59  			name: "StringPtr",
    60  			data: stringptr("a"),
    61  		},
    62  		{
    63  			name: "StringPtr3",
    64  			data: stringptr3("a"),
    65  		},
    66  		{
    67  			name: "StringPtrNil",
    68  			data: (*string)(nil),
    69  		},
    70  		{
    71  			name: "StringPtr3Nil",
    72  			data: (***string)(nil),
    73  		},
    74  
    75  		// HeadStringZero
    76  		{
    77  			name: "HeadStringZero",
    78  			data: struct {
    79  				A string `json:"a"`
    80  			}{},
    81  		},
    82  		{
    83  			name: "HeadStringZeroOmitEmpty",
    84  			data: struct {
    85  				A string `json:"a,omitempty"`
    86  			}{},
    87  		},
    88  		{
    89  			name: "HeadStringZeroString",
    90  			data: struct {
    91  				A string `json:"a,string"`
    92  			}{},
    93  		},
    94  		{
    95  			name: "HeadStringZeroStringOmitEmpty",
    96  			data: struct {
    97  				A string `json:"a,string,omitempty"`
    98  			}{},
    99  		},
   100  
   101  		// HeadString
   102  		{
   103  			name: "HeadString",
   104  			data: struct {
   105  				A string `json:"a"`
   106  			}{A: "foo"},
   107  		},
   108  		{
   109  			name: "HeadStringOmitEmpty",
   110  			data: struct {
   111  				A string `json:"a,omitempty"`
   112  			}{A: "foo"},
   113  		},
   114  		{
   115  			name: "HeadStringString",
   116  			data: struct {
   117  				A string `json:"a,string"`
   118  			}{A: "foo"},
   119  		},
   120  		{
   121  			name: "HeadStringStringOmitEmpty",
   122  			data: struct {
   123  				A string `json:"a,string,omitempty"`
   124  			}{A: "foo"},
   125  		},
   126  
   127  		// HeadStringPtr
   128  		{
   129  			name: "HeadStringPtr",
   130  			data: struct {
   131  				A *string `json:"a"`
   132  			}{A: stringptr("foo")},
   133  		},
   134  		{
   135  			name: "HeadStringPtrOmitEmpty",
   136  			data: struct {
   137  				A *string `json:"a,omitempty"`
   138  			}{A: stringptr("foo")},
   139  		},
   140  		{
   141  			name: "HeadStringPtrString",
   142  			data: struct {
   143  				A *string `json:"a,string"`
   144  			}{A: stringptr("foo")},
   145  		},
   146  		{
   147  			name: "HeadStringPtrStringOmitEmpty",
   148  			data: struct {
   149  				A *string `json:"a,string,omitempty"`
   150  			}{A: stringptr("foo")},
   151  		},
   152  
   153  		// HeadStringPtrNil
   154  		{
   155  			name: "HeadStringPtrNil",
   156  			data: struct {
   157  				A *string `json:"a"`
   158  			}{A: nil},
   159  		},
   160  		{
   161  			name: "HeadStringPtrNilOmitEmpty",
   162  			data: struct {
   163  				A *string `json:"a,omitempty"`
   164  			}{A: nil},
   165  		},
   166  		{
   167  			name: "HeadStringPtrNilString",
   168  			data: struct {
   169  				A *string `json:"a,string"`
   170  			}{A: nil},
   171  		},
   172  		{
   173  			name: "HeadStringPtrNilStringOmitEmpty",
   174  			data: struct {
   175  				A *string `json:"a,string,omitempty"`
   176  			}{A: nil},
   177  		},
   178  
   179  		// PtrHeadStringZero
   180  		{
   181  			name: "PtrHeadStringZero",
   182  			data: &struct {
   183  				A string `json:"a"`
   184  			}{},
   185  		},
   186  		{
   187  			name: "PtrHeadStringZeroOmitEmpty",
   188  			data: &struct {
   189  				A string `json:"a,omitempty"`
   190  			}{},
   191  		},
   192  		{
   193  			name: "PtrHeadStringZeroString",
   194  			data: &struct {
   195  				A string `json:"a,string"`
   196  			}{},
   197  		},
   198  		{
   199  			name: "PtrHeadStringZeroStringOmitEmpty",
   200  			data: &struct {
   201  				A string `json:"a,string,omitempty"`
   202  			}{},
   203  		},
   204  
   205  		// PtrHeadString
   206  		{
   207  			name: "PtrHeadString",
   208  			data: &struct {
   209  				A string `json:"a"`
   210  			}{A: "foo"},
   211  		},
   212  		{
   213  			name: "PtrHeadStringOmitEmpty",
   214  			data: &struct {
   215  				A string `json:"a,omitempty"`
   216  			}{A: "foo"},
   217  		},
   218  		{
   219  			name: "PtrHeadStringString",
   220  			data: &struct {
   221  				A string `json:"a,string"`
   222  			}{A: "foo"},
   223  		},
   224  		{
   225  			name: "PtrHeadStringStringOmitEmpty",
   226  			data: &struct {
   227  				A string `json:"a,string,omitempty"`
   228  			}{A: "foo"},
   229  		},
   230  
   231  		// PtrHeadStringPtr
   232  		{
   233  			name: "PtrHeadStringPtr",
   234  			data: &struct {
   235  				A *string `json:"a"`
   236  			}{A: stringptr("foo")},
   237  		},
   238  		{
   239  			name: "PtrHeadStringPtrOmitEmpty",
   240  			data: &struct {
   241  				A *string `json:"a,omitempty"`
   242  			}{A: stringptr("foo")},
   243  		},
   244  		{
   245  			name: "PtrHeadStringPtrString",
   246  			data: &struct {
   247  				A *string `json:"a,string"`
   248  			}{A: stringptr("foo")},
   249  		},
   250  		{
   251  			name: "PtrHeadStringPtrStringOmitEmpty",
   252  			data: &struct {
   253  				A *string `json:"a,string,omitempty"`
   254  			}{A: stringptr("foo")},
   255  		},
   256  
   257  		// PtrHeadStringPtrNil
   258  		{
   259  			name: "PtrHeadStringPtrNil",
   260  			data: &struct {
   261  				A *string `json:"a"`
   262  			}{A: nil},
   263  		},
   264  		{
   265  			name: "PtrHeadStringPtrNilOmitEmpty",
   266  			data: &struct {
   267  				A *string `json:"a,omitempty"`
   268  			}{A: nil},
   269  		},
   270  		{
   271  			name: "PtrHeadStringPtrNilString",
   272  			data: &struct {
   273  				A *string `json:"a,string"`
   274  			}{A: nil},
   275  		},
   276  		{
   277  			name: "PtrHeadStringPtrNilStringOmitEmpty",
   278  			data: &struct {
   279  				A *string `json:"a,string,omitempty"`
   280  			}{A: nil},
   281  		},
   282  
   283  		// PtrHeadStringNil
   284  		{
   285  			name: "PtrHeadStringNil",
   286  			data: (*struct {
   287  				A *string `json:"a"`
   288  			})(nil),
   289  		},
   290  		{
   291  			name: "PtrHeadStringNilOmitEmpty",
   292  			data: (*struct {
   293  				A *string `json:"a,omitempty"`
   294  			})(nil),
   295  		},
   296  		{
   297  			name: "PtrHeadStringNilString",
   298  			data: (*struct {
   299  				A *string `json:"a,string"`
   300  			})(nil),
   301  		},
   302  		{
   303  			name: "PtrHeadStringNilStringOmitEmpty",
   304  			data: (*struct {
   305  				A *string `json:"a,string,omitempty"`
   306  			})(nil),
   307  		},
   308  
   309  		// HeadStringZeroMultiFields
   310  		{
   311  			name: "HeadStringZeroMultiFields",
   312  			data: struct {
   313  				A string `json:"a"`
   314  				B string `json:"b"`
   315  				C string `json:"c"`
   316  			}{},
   317  		},
   318  		{
   319  			name: "HeadStringZeroMultiFieldsOmitEmpty",
   320  			data: struct {
   321  				A string `json:"a,omitempty"`
   322  				B string `json:"b,omitempty"`
   323  				C string `json:"c,omitempty"`
   324  			}{},
   325  		},
   326  		{
   327  			name: "HeadStringZeroMultiFieldsString",
   328  			data: struct {
   329  				A string `json:"a,string"`
   330  				B string `json:"b,string"`
   331  				C string `json:"c,string"`
   332  			}{},
   333  		},
   334  		{
   335  			name: "HeadStringZeroMultiFieldsStringOmitEmpty",
   336  			data: struct {
   337  				A string `json:"a,string,omitempty"`
   338  				B string `json:"b,string,omitempty"`
   339  				C string `json:"c,string,omitempty"`
   340  			}{},
   341  		},
   342  
   343  		// HeadStringMultiFields
   344  		{
   345  			name: "HeadStringMultiFields",
   346  			data: struct {
   347  				A string `json:"a"`
   348  				B string `json:"b"`
   349  				C string `json:"c"`
   350  			}{A: "foo", B: "bar", C: "baz"},
   351  		},
   352  		{
   353  			name: "HeadStringMultiFieldsOmitEmpty",
   354  			data: struct {
   355  				A string `json:"a,omitempty"`
   356  				B string `json:"b,omitempty"`
   357  				C string `json:"c,omitempty"`
   358  			}{A: "foo", B: "bar", C: "baz"},
   359  		},
   360  		{
   361  			name: "HeadStringMultiFieldsString",
   362  			data: struct {
   363  				A string `json:"a,string"`
   364  				B string `json:"b,string"`
   365  				C string `json:"c,string"`
   366  			}{A: "foo", B: "bar", C: "baz"},
   367  		},
   368  		{
   369  			name: "HeadStringMultiFieldsStringOmitEmpty",
   370  			data: struct {
   371  				A string `json:"a,string,omitempty"`
   372  				B string `json:"b,string,omitempty"`
   373  				C string `json:"c,string,omitempty"`
   374  			}{A: "foo", B: "bar", C: "baz"},
   375  		},
   376  
   377  		// HeadStringPtrMultiFields
   378  		{
   379  			name: "HeadStringPtrMultiFields",
   380  			data: struct {
   381  				A *string `json:"a"`
   382  				B *string `json:"b"`
   383  				C *string `json:"c"`
   384  			}{A: stringptr("foo"), B: stringptr("bar"), C: stringptr("baz")},
   385  		},
   386  		{
   387  			name: "HeadStringPtrMultiFieldsOmitEmpty",
   388  			data: struct {
   389  				A *string `json:"a,omitempty"`
   390  				B *string `json:"b,omitempty"`
   391  				C *string `json:"c,omitempty"`
   392  			}{A: stringptr("foo"), B: stringptr("bar"), C: stringptr("baz")},
   393  		},
   394  		{
   395  			name: "HeadStringPtrMultiFieldsString",
   396  			data: struct {
   397  				A *string `json:"a,string"`
   398  				B *string `json:"b,string"`
   399  				C *string `json:"c,string"`
   400  			}{A: stringptr("foo"), B: stringptr("bar"), C: stringptr("baz")},
   401  		},
   402  		{
   403  			name: "HeadStringPtrMultiFieldsStringOmitEmpty",
   404  			data: struct {
   405  				A *string `json:"a,string,omitempty"`
   406  				B *string `json:"b,string,omitempty"`
   407  				C *string `json:"c,string,omitempty"`
   408  			}{A: stringptr("foo"), B: stringptr("bar"), C: stringptr("baz")},
   409  		},
   410  
   411  		// HeadStringPtrNilMultiFields
   412  		{
   413  			name: "HeadStringPtrNilMultiFields",
   414  			data: struct {
   415  				A *string `json:"a"`
   416  				B *string `json:"b"`
   417  				C *string `json:"c"`
   418  			}{A: nil, B: nil, C: nil},
   419  		},
   420  		{
   421  			name: "HeadStringPtrNilMultiFieldsOmitEmpty",
   422  			data: struct {
   423  				A *string `json:"a,omitempty"`
   424  				B *string `json:"b,omitempty"`
   425  				C *string `json:"c,omitempty"`
   426  			}{A: nil, B: nil, C: nil},
   427  		},
   428  		{
   429  			name: "HeadStringPtrNilMultiFieldsString",
   430  			data: struct {
   431  				A *string `json:"a,string"`
   432  				B *string `json:"b,string"`
   433  				C *string `json:"c,string"`
   434  			}{A: nil, B: nil, C: nil},
   435  		},
   436  		{
   437  			name: "HeadStringPtrNilMultiFieldsStringOmitEmpty",
   438  			data: struct {
   439  				A *string `json:"a,string,omitempty"`
   440  				B *string `json:"b,string,omitempty"`
   441  				C *string `json:"c,string,omitempty"`
   442  			}{A: nil, B: nil, C: nil},
   443  		},
   444  
   445  		// PtrHeadStringZeroMultiFields
   446  		{
   447  			name: "PtrHeadStringZeroMultiFields",
   448  			data: &struct {
   449  				A string `json:"a"`
   450  				B string `json:"b"`
   451  				C string `json:"c"`
   452  			}{},
   453  		},
   454  		{
   455  			name: "PtrHeadStringZeroMultiFieldsOmitEmpty",
   456  			data: &struct {
   457  				A string `json:"a,omitempty"`
   458  				B string `json:"b,omitempty"`
   459  				C string `json:"c,omitempty"`
   460  			}{},
   461  		},
   462  		{
   463  			name: "PtrHeadStringZeroMultiFieldsString",
   464  			data: &struct {
   465  				A string `json:"a,string"`
   466  				B string `json:"b,string"`
   467  				C string `json:"c,string"`
   468  			}{},
   469  		},
   470  		{
   471  			name: "PtrHeadStringZeroMultiFieldsStringOmitEmpty",
   472  			data: &struct {
   473  				A string `json:"a,string,omitempty"`
   474  				B string `json:"b,string,omitempty"`
   475  				C string `json:"c,string,omitempty"`
   476  			}{},
   477  		},
   478  
   479  		// PtrHeadStringMultiFields
   480  		{
   481  			name: "PtrHeadStringMultiFields",
   482  			data: &struct {
   483  				A string `json:"a"`
   484  				B string `json:"b"`
   485  				C string `json:"c"`
   486  			}{A: "foo", B: "bar", C: "baz"},
   487  		},
   488  		{
   489  			name: "PtrHeadStringMultiFieldsOmitEmpty",
   490  			data: &struct {
   491  				A string `json:"a,omitempty"`
   492  				B string `json:"b,omitempty"`
   493  				C string `json:"c,omitempty"`
   494  			}{A: "foo", B: "bar", C: "baz"},
   495  		},
   496  		{
   497  			name: "PtrHeadStringMultiFieldsString",
   498  			data: &struct {
   499  				A string `json:"a,string"`
   500  				B string `json:"b,string"`
   501  				C string `json:"c,string"`
   502  			}{A: "foo", B: "bar", C: "baz"},
   503  		},
   504  		{
   505  			name: "PtrHeadStringMultiFieldsStringOmitEmpty",
   506  			data: &struct {
   507  				A string `json:"a,string,omitempty"`
   508  				B string `json:"b,string,omitempty"`
   509  				C string `json:"c,string,omitempty"`
   510  			}{A: "foo", B: "bar", C: "baz"},
   511  		},
   512  
   513  		// PtrHeadStringPtrMultiFields
   514  		{
   515  			name: "PtrHeadStringPtrMultiFields",
   516  			data: &struct {
   517  				A *string `json:"a"`
   518  				B *string `json:"b"`
   519  				C *string `json:"c"`
   520  			}{A: stringptr("foo"), B: stringptr("bar"), C: stringptr("baz")},
   521  		},
   522  		{
   523  			name: "PtrHeadStringPtrMultiFieldsOmitEmpty",
   524  			data: &struct {
   525  				A *string `json:"a,omitempty"`
   526  				B *string `json:"b,omitempty"`
   527  				C *string `json:"c,omitempty"`
   528  			}{A: stringptr("foo"), B: stringptr("bar"), C: stringptr("baz")},
   529  		},
   530  		{
   531  			name: "PtrHeadStringPtrMultiFieldsString",
   532  			data: &struct {
   533  				A *string `json:"a,string"`
   534  				B *string `json:"b,string"`
   535  				C *string `json:"c,string"`
   536  			}{A: stringptr("foo"), B: stringptr("bar"), C: stringptr("baz")},
   537  		},
   538  		{
   539  			name: "PtrHeadStringPtrMultiFieldsStringOmitEmpty",
   540  			data: &struct {
   541  				A *string `json:"a,string,omitempty"`
   542  				B *string `json:"b,string,omitempty"`
   543  				C *string `json:"c,string,omitempty"`
   544  			}{A: stringptr("foo"), B: stringptr("bar"), C: stringptr("baz")},
   545  		},
   546  
   547  		// PtrHeadStringPtrNilMultiFields
   548  		{
   549  			name: "PtrHeadStringPtrNilMultiFields",
   550  			data: &struct {
   551  				A *string `json:"a"`
   552  				B *string `json:"b"`
   553  				C *string `json:"c"`
   554  			}{A: nil, B: nil, C: nil},
   555  		},
   556  		{
   557  			name: "PtrHeadStringPtrNilMultiFieldsOmitEmpty",
   558  			data: &struct {
   559  				A *string `json:"a,omitempty"`
   560  				B *string `json:"b,omitempty"`
   561  				C *string `json:"c,omitempty"`
   562  			}{A: nil, B: nil, C: nil},
   563  		},
   564  		{
   565  			name: "PtrHeadStringPtrNilMultiFieldsString",
   566  			data: &struct {
   567  				A *string `json:"a,string"`
   568  				B *string `json:"b,string"`
   569  				C *string `json:"c,string"`
   570  			}{A: nil, B: nil, C: nil},
   571  		},
   572  		{
   573  			name: "PtrHeadStringPtrNilMultiFieldsStringOmitEmpty",
   574  			data: &struct {
   575  				A *string `json:"a,string,omitempty"`
   576  				B *string `json:"b,string,omitempty"`
   577  				C *string `json:"c,string,omitempty"`
   578  			}{A: nil, B: nil, C: nil},
   579  		},
   580  
   581  		// PtrHeadStringNilMultiFields
   582  		{
   583  			name: "PtrHeadStringNilMultiFields",
   584  			data: (*struct {
   585  				A *string `json:"a"`
   586  				B *string `json:"b"`
   587  				C *string `json:"c"`
   588  			})(nil),
   589  		},
   590  		{
   591  			name: "PtrHeadStringNilMultiFieldsOmitEmpty",
   592  			data: (*struct {
   593  				A *string `json:"a,omitempty"`
   594  				B *string `json:"b,omitempty"`
   595  				C *string `json:"c,omitempty"`
   596  			})(nil),
   597  		},
   598  		{
   599  			name: "PtrHeadStringNilMultiFieldsString",
   600  			data: (*struct {
   601  				A *string `json:"a,string"`
   602  				B *string `json:"b,string"`
   603  				C *string `json:"c,string"`
   604  			})(nil),
   605  		},
   606  		{
   607  			name: "PtrHeadStringNilMultiFieldsStringOmitEmpty",
   608  			data: (*struct {
   609  				A *string `json:"a,string,omitempty"`
   610  				B *string `json:"b,string,omitempty"`
   611  				C *string `json:"c,string,omitempty"`
   612  			})(nil),
   613  		},
   614  
   615  		// HeadStringZeroNotRoot
   616  		{
   617  			name: "HeadStringZeroNotRoot",
   618  			data: struct {
   619  				A struct {
   620  					A string `json:"a"`
   621  				}
   622  			}{},
   623  		},
   624  		{
   625  			name: "HeadStringZeroNotRootOmitEmpty",
   626  			data: struct {
   627  				A struct {
   628  					A string `json:"a,omitempty"`
   629  				}
   630  			}{},
   631  		},
   632  		{
   633  			name: "HeadStringZeroNotRootString",
   634  			data: struct {
   635  				A struct {
   636  					A string `json:"a,string"`
   637  				}
   638  			}{},
   639  		},
   640  		{
   641  			name: "HeadStringZeroNotRootStringOmitEmpty",
   642  			data: struct {
   643  				A struct {
   644  					A string `json:"a,string,omitempty"`
   645  				}
   646  			}{},
   647  		},
   648  
   649  		// HeadStringNotRoot
   650  		{
   651  			name: "HeadStringNotRoot",
   652  			data: struct {
   653  				A struct {
   654  					A string `json:"a"`
   655  				}
   656  			}{A: struct {
   657  				A string `json:"a"`
   658  			}{A: "foo"}},
   659  		},
   660  		{
   661  			name: "HeadStringNotRootOmitEmpty",
   662  			data: struct {
   663  				A struct {
   664  					A string `json:"a,omitempty"`
   665  				}
   666  			}{A: struct {
   667  				A string `json:"a,omitempty"`
   668  			}{A: "foo"}},
   669  		},
   670  		{
   671  			name: "HeadStringNotRootString",
   672  			data: struct {
   673  				A struct {
   674  					A string `json:"a,string"`
   675  				}
   676  			}{A: struct {
   677  				A string `json:"a,string"`
   678  			}{A: "foo"}},
   679  		},
   680  		{
   681  			name: "HeadStringNotRootStringOmitEmpty",
   682  			data: struct {
   683  				A struct {
   684  					A string `json:"a,string,omitempty"`
   685  				}
   686  			}{A: struct {
   687  				A string `json:"a,string,omitempty"`
   688  			}{A: "foo"}},
   689  		},
   690  
   691  		// HeadStringPtrNotRoot
   692  		{
   693  			name: "HeadStringPtrNotRoot",
   694  			data: struct {
   695  				A struct {
   696  					A *string `json:"a"`
   697  				}
   698  			}{A: struct {
   699  				A *string `json:"a"`
   700  			}{stringptr("foo")}},
   701  		},
   702  		{
   703  			name: "HeadStringPtrNotRootOmitEmpty",
   704  			data: struct {
   705  				A struct {
   706  					A *string `json:"a,omitempty"`
   707  				}
   708  			}{A: struct {
   709  				A *string `json:"a,omitempty"`
   710  			}{stringptr("foo")}},
   711  		},
   712  		{
   713  			name: "HeadStringPtrNotRootString",
   714  			data: struct {
   715  				A struct {
   716  					A *string `json:"a,string"`
   717  				}
   718  			}{A: struct {
   719  				A *string `json:"a,string"`
   720  			}{stringptr("foo")}},
   721  		},
   722  		{
   723  			name: "HeadStringPtrNotRootStringOmitEmpty",
   724  			data: struct {
   725  				A struct {
   726  					A *string `json:"a,string,omitempty"`
   727  				}
   728  			}{A: struct {
   729  				A *string `json:"a,string,omitempty"`
   730  			}{stringptr("foo")}},
   731  		},
   732  
   733  		// HeadStringPtrNilNotRoot
   734  		{
   735  			name: "HeadStringPtrNilNotRoot",
   736  			data: struct {
   737  				A struct {
   738  					A *string `json:"a"`
   739  				}
   740  			}{},
   741  		},
   742  		{
   743  			name: "HeadStringPtrNilNotRootOmitEmpty",
   744  			data: struct {
   745  				A struct {
   746  					A *string `json:"a,omitempty"`
   747  				}
   748  			}{},
   749  		},
   750  		{
   751  			name: "HeadStringPtrNilNotRootString",
   752  			data: struct {
   753  				A struct {
   754  					A *string `json:"a,string"`
   755  				}
   756  			}{},
   757  		},
   758  		{
   759  			name: "HeadStringPtrNilNotRootStringOmitEmpty",
   760  			data: struct {
   761  				A struct {
   762  					A *string `json:"a,string,omitempty"`
   763  				}
   764  			}{},
   765  		},
   766  
   767  		// PtrHeadStringZeroNotRoot
   768  		{
   769  			name: "PtrHeadStringZeroNotRoot",
   770  			data: struct {
   771  				A *struct {
   772  					A string `json:"a"`
   773  				}
   774  			}{A: new(struct {
   775  				A string `json:"a"`
   776  			})},
   777  		},
   778  		{
   779  			name: "PtrHeadStringZeroNotRootOmitEmpty",
   780  			data: struct {
   781  				A *struct {
   782  					A string `json:"a,omitempty"`
   783  				}
   784  			}{A: new(struct {
   785  				A string `json:"a,omitempty"`
   786  			})},
   787  		},
   788  		{
   789  			name: "PtrHeadStringZeroNotRootString",
   790  			data: struct {
   791  				A *struct {
   792  					A string `json:"a,string"`
   793  				}
   794  			}{A: new(struct {
   795  				A string `json:"a,string"`
   796  			})},
   797  		},
   798  		{
   799  			name: "PtrHeadStringZeroNotRootStringOmitEmpty",
   800  			data: struct {
   801  				A *struct {
   802  					A string `json:"a,string,omitempty"`
   803  				}
   804  			}{A: new(struct {
   805  				A string `json:"a,string,omitempty"`
   806  			})},
   807  		},
   808  
   809  		// PtrHeadStringNotRoot
   810  		{
   811  			name: "PtrHeadStringNotRoot",
   812  			data: struct {
   813  				A *struct {
   814  					A string `json:"a"`
   815  				}
   816  			}{A: &(struct {
   817  				A string `json:"a"`
   818  			}{A: "foo"})},
   819  		},
   820  		{
   821  			name: "PtrHeadStringNotRootOmitEmpty",
   822  			data: struct {
   823  				A *struct {
   824  					A string `json:"a,omitempty"`
   825  				}
   826  			}{A: &(struct {
   827  				A string `json:"a,omitempty"`
   828  			}{A: "foo"})},
   829  		},
   830  		{
   831  			name: "PtrHeadStringNotRootString",
   832  			data: struct {
   833  				A *struct {
   834  					A string `json:"a,string"`
   835  				}
   836  			}{A: &(struct {
   837  				A string `json:"a,string"`
   838  			}{A: "foo"})},
   839  		},
   840  		{
   841  			name: "PtrHeadStringNotRootStringOmitEmpty",
   842  			data: struct {
   843  				A *struct {
   844  					A string `json:"a,string,omitempty"`
   845  				}
   846  			}{A: &(struct {
   847  				A string `json:"a,string,omitempty"`
   848  			}{A: "foo"})},
   849  		},
   850  
   851  		// PtrHeadStringPtrNotRoot
   852  		{
   853  			name: "PtrHeadStringPtrNotRoot",
   854  			data: struct {
   855  				A *struct {
   856  					A *string `json:"a"`
   857  				}
   858  			}{A: &(struct {
   859  				A *string `json:"a"`
   860  			}{A: stringptr("foo")})},
   861  		},
   862  		{
   863  			name: "PtrHeadStringPtrNotRootOmitEmpty",
   864  			data: struct {
   865  				A *struct {
   866  					A *string `json:"a,omitempty"`
   867  				}
   868  			}{A: &(struct {
   869  				A *string `json:"a,omitempty"`
   870  			}{A: stringptr("foo")})},
   871  		},
   872  		{
   873  			name: "PtrHeadStringPtrNotRootString",
   874  			data: struct {
   875  				A *struct {
   876  					A *string `json:"a,string"`
   877  				}
   878  			}{A: &(struct {
   879  				A *string `json:"a,string"`
   880  			}{A: stringptr("foo")})},
   881  		},
   882  		{
   883  			name: "PtrHeadStringPtrNotRootStringOmitEmpty",
   884  			data: struct {
   885  				A *struct {
   886  					A *string `json:"a,string,omitempty"`
   887  				}
   888  			}{A: &(struct {
   889  				A *string `json:"a,string,omitempty"`
   890  			}{A: stringptr("foo")})},
   891  		},
   892  
   893  		// PtrHeadStringPtrNilNotRoot
   894  		{
   895  			name: "PtrHeadStringPtrNilNotRoot",
   896  			data: struct {
   897  				A *struct {
   898  					A *string `json:"a"`
   899  				}
   900  			}{A: &(struct {
   901  				A *string `json:"a"`
   902  			}{A: nil})},
   903  		},
   904  		{
   905  			name: "PtrHeadStringPtrNilNotRootOmitEmpty",
   906  			data: struct {
   907  				A *struct {
   908  					A *string `json:"a,omitempty"`
   909  				}
   910  			}{A: &(struct {
   911  				A *string `json:"a,omitempty"`
   912  			}{A: nil})},
   913  		},
   914  		{
   915  			name: "PtrHeadStringPtrNilNotRootString",
   916  			data: struct {
   917  				A *struct {
   918  					A *string `json:"a,string"`
   919  				}
   920  			}{A: &(struct {
   921  				A *string `json:"a,string"`
   922  			}{A: nil})},
   923  		},
   924  		{
   925  			name: "PtrHeadStringPtrNilNotRootStringOmitEmpty",
   926  			data: struct {
   927  				A *struct {
   928  					A *string `json:"a,string,omitempty"`
   929  				}
   930  			}{A: &(struct {
   931  				A *string `json:"a,string,omitempty"`
   932  			}{A: nil})},
   933  		},
   934  
   935  		// PtrHeadStringNilNotRoot
   936  		{
   937  			name: "PtrHeadStringNilNotRoot",
   938  			data: struct {
   939  				A *struct {
   940  					A *string `json:"a"`
   941  				}
   942  			}{A: nil},
   943  		},
   944  		{
   945  			name: "PtrHeadStringNilNotRootOmitEmpty",
   946  			data: struct {
   947  				A *struct {
   948  					A *string `json:"a,omitempty"`
   949  				} `json:",omitempty"`
   950  			}{A: nil},
   951  		},
   952  		{
   953  			name: "PtrHeadStringNilNotRootString",
   954  			data: struct {
   955  				A *struct {
   956  					A *string `json:"a,string"`
   957  				} `json:",string"`
   958  			}{A: nil},
   959  		},
   960  		{
   961  			name: "PtrHeadStringNilNotRootStringOmitEmpty",
   962  			data: struct {
   963  				A *struct {
   964  					A *string `json:"a,string,omitempty"`
   965  				} `json:",string,omitempty"`
   966  			}{A: nil},
   967  		},
   968  
   969  		// HeadStringZeroMultiFieldsNotRoot
   970  		{
   971  			name: "HeadStringZeroMultiFieldsNotRoot",
   972  			data: struct {
   973  				A struct {
   974  					A string `json:"a"`
   975  				}
   976  				B struct {
   977  					B string `json:"b"`
   978  				}
   979  			}{},
   980  		},
   981  		{
   982  			name: "HeadStringZeroMultiFieldsNotRootOmitEmpty",
   983  			data: struct {
   984  				A struct {
   985  					A string `json:"a,omitempty"`
   986  				}
   987  				B struct {
   988  					B string `json:"b,omitempty"`
   989  				}
   990  			}{},
   991  		},
   992  		{
   993  			name: "HeadStringZeroMultiFieldsNotRootString",
   994  			data: struct {
   995  				A struct {
   996  					A string `json:"a,string"`
   997  				}
   998  				B struct {
   999  					B string `json:"b,string"`
  1000  				}
  1001  			}{},
  1002  		},
  1003  		{
  1004  			name: "HeadStringZeroMultiFieldsNotRootStringOmitEmpty",
  1005  			data: struct {
  1006  				A struct {
  1007  					A string `json:"a,string,omitempty"`
  1008  				}
  1009  				B struct {
  1010  					B string `json:"b,string,omitempty"`
  1011  				}
  1012  			}{},
  1013  		},
  1014  
  1015  		// HeadStringMultiFieldsNotRoot
  1016  		{
  1017  			name: "HeadStringMultiFieldsNotRoot",
  1018  			data: struct {
  1019  				A struct {
  1020  					A string `json:"a"`
  1021  				}
  1022  				B struct {
  1023  					B string `json:"b"`
  1024  				}
  1025  			}{A: struct {
  1026  				A string `json:"a"`
  1027  			}{A: "foo"}, B: struct {
  1028  				B string `json:"b"`
  1029  			}{B: "bar"}},
  1030  		},
  1031  		{
  1032  			name: "HeadStringMultiFieldsNotRootOmitEmpty",
  1033  			data: struct {
  1034  				A struct {
  1035  					A string `json:"a,omitempty"`
  1036  				}
  1037  				B struct {
  1038  					B string `json:"b,omitempty"`
  1039  				}
  1040  			}{A: struct {
  1041  				A string `json:"a,omitempty"`
  1042  			}{A: "foo"}, B: struct {
  1043  				B string `json:"b,omitempty"`
  1044  			}{B: "bar"}},
  1045  		},
  1046  		{
  1047  			name: "HeadStringMultiFieldsNotRootString",
  1048  			data: struct {
  1049  				A struct {
  1050  					A string `json:"a,string"`
  1051  				}
  1052  				B struct {
  1053  					B string `json:"b,string"`
  1054  				}
  1055  			}{A: struct {
  1056  				A string `json:"a,string"`
  1057  			}{A: "foo"}, B: struct {
  1058  				B string `json:"b,string"`
  1059  			}{B: "bar"}},
  1060  		},
  1061  		{
  1062  			name: "HeadStringMultiFieldsNotRootStringOmitEmpty",
  1063  			data: struct {
  1064  				A struct {
  1065  					A string `json:"a,string,omitempty"`
  1066  				}
  1067  				B struct {
  1068  					B string `json:"b,string,omitempty"`
  1069  				}
  1070  			}{A: struct {
  1071  				A string `json:"a,string,omitempty"`
  1072  			}{A: "foo"}, B: struct {
  1073  				B string `json:"b,string,omitempty"`
  1074  			}{B: "bar"}},
  1075  		},
  1076  
  1077  		// HeadStringPtrMultiFieldsNotRoot
  1078  		{
  1079  			name: "HeadStringPtrMultiFieldsNotRoot",
  1080  			data: struct {
  1081  				A struct {
  1082  					A *string `json:"a"`
  1083  				}
  1084  				B struct {
  1085  					B *string `json:"b"`
  1086  				}
  1087  			}{A: struct {
  1088  				A *string `json:"a"`
  1089  			}{A: stringptr("foo")}, B: struct {
  1090  				B *string `json:"b"`
  1091  			}{B: stringptr("bar")}},
  1092  		},
  1093  		{
  1094  			name: "HeadStringPtrMultiFieldsNotRootOmitEmpty",
  1095  			data: struct {
  1096  				A struct {
  1097  					A *string `json:"a,omitempty"`
  1098  				}
  1099  				B struct {
  1100  					B *string `json:"b,omitempty"`
  1101  				}
  1102  			}{A: struct {
  1103  				A *string `json:"a,omitempty"`
  1104  			}{A: stringptr("foo")}, B: struct {
  1105  				B *string `json:"b,omitempty"`
  1106  			}{B: stringptr("bar")}},
  1107  		},
  1108  		{
  1109  			name: "HeadStringPtrMultiFieldsNotRootString",
  1110  			data: struct {
  1111  				A struct {
  1112  					A *string `json:"a,string"`
  1113  				}
  1114  				B struct {
  1115  					B *string `json:"b,string"`
  1116  				}
  1117  			}{A: struct {
  1118  				A *string `json:"a,string"`
  1119  			}{A: stringptr("foo")}, B: struct {
  1120  				B *string `json:"b,string"`
  1121  			}{B: stringptr("bar")}},
  1122  		},
  1123  		{
  1124  			name: "HeadStringPtrMultiFieldsNotRootStringOmitEmpty",
  1125  			data: struct {
  1126  				A struct {
  1127  					A *string `json:"a,string,omitempty"`
  1128  				}
  1129  				B struct {
  1130  					B *string `json:"b,string,omitempty"`
  1131  				}
  1132  			}{A: struct {
  1133  				A *string `json:"a,string,omitempty"`
  1134  			}{A: stringptr("foo")}, B: struct {
  1135  				B *string `json:"b,string,omitempty"`
  1136  			}{B: stringptr("bar")}},
  1137  		},
  1138  
  1139  		// HeadStringPtrNilMultiFieldsNotRoot
  1140  		{
  1141  			name: "HeadStringPtrNilMultiFieldsNotRoot",
  1142  			data: struct {
  1143  				A struct {
  1144  					A *string `json:"a"`
  1145  				}
  1146  				B struct {
  1147  					B *string `json:"b"`
  1148  				}
  1149  			}{A: struct {
  1150  				A *string `json:"a"`
  1151  			}{A: nil}, B: struct {
  1152  				B *string `json:"b"`
  1153  			}{B: nil}},
  1154  		},
  1155  		{
  1156  			name: "HeadStringPtrNilMultiFieldsNotRootOmitEmpty",
  1157  			data: struct {
  1158  				A struct {
  1159  					A *string `json:"a,omitempty"`
  1160  				}
  1161  				B struct {
  1162  					B *string `json:"b,omitempty"`
  1163  				}
  1164  			}{A: struct {
  1165  				A *string `json:"a,omitempty"`
  1166  			}{A: nil}, B: struct {
  1167  				B *string `json:"b,omitempty"`
  1168  			}{B: nil}},
  1169  		},
  1170  		{
  1171  			name: "HeadStringPtrNilMultiFieldsNotRootString",
  1172  			data: struct {
  1173  				A struct {
  1174  					A *string `json:"a,string"`
  1175  				}
  1176  				B struct {
  1177  					B *string `json:"b,string"`
  1178  				}
  1179  			}{A: struct {
  1180  				A *string `json:"a,string"`
  1181  			}{A: nil}, B: struct {
  1182  				B *string `json:"b,string"`
  1183  			}{B: nil}},
  1184  		},
  1185  		{
  1186  			name: "HeadStringPtrNilMultiFieldsNotRootStringOmitEmpty",
  1187  			data: struct {
  1188  				A struct {
  1189  					A *string `json:"a,string,omitempty"`
  1190  				}
  1191  				B struct {
  1192  					B *string `json:"b,string,omitempty"`
  1193  				}
  1194  			}{A: struct {
  1195  				A *string `json:"a,string,omitempty"`
  1196  			}{A: nil}, B: struct {
  1197  				B *string `json:"b,string,omitempty"`
  1198  			}{B: nil}},
  1199  		},
  1200  
  1201  		// PtrHeadStringZeroMultiFieldsNotRoot
  1202  		{
  1203  			name: "PtrHeadStringZeroMultiFieldsNotRoot",
  1204  			data: &struct {
  1205  				A struct {
  1206  					A string `json:"a"`
  1207  				}
  1208  				B struct {
  1209  					B string `json:"b"`
  1210  				}
  1211  			}{},
  1212  		},
  1213  		{
  1214  			name: "PtrHeadStringZeroMultiFieldsNotRootOmitEmpty",
  1215  			data: &struct {
  1216  				A struct {
  1217  					A string `json:"a,omitempty"`
  1218  				}
  1219  				B struct {
  1220  					B string `json:"b,omitempty"`
  1221  				}
  1222  			}{},
  1223  		},
  1224  		{
  1225  			name: "PtrHeadStringZeroMultiFieldsNotRootString",
  1226  			data: &struct {
  1227  				A struct {
  1228  					A string `json:"a,string"`
  1229  				}
  1230  				B struct {
  1231  					B string `json:"b,string"`
  1232  				}
  1233  			}{},
  1234  		},
  1235  		{
  1236  			name: "PtrHeadStringZeroMultiFieldsNotRootStringOmitEmpty",
  1237  			data: &struct {
  1238  				A struct {
  1239  					A string `json:"a,string,omitempty"`
  1240  				}
  1241  				B struct {
  1242  					B string `json:"b,string,omitempty"`
  1243  				}
  1244  			}{},
  1245  		},
  1246  
  1247  		// PtrHeadStringMultiFieldsNotRoot
  1248  		{
  1249  			name: "PtrHeadStringMultiFieldsNotRoot",
  1250  			data: &struct {
  1251  				A struct {
  1252  					A string `json:"a"`
  1253  				}
  1254  				B struct {
  1255  					B string `json:"b"`
  1256  				}
  1257  			}{A: struct {
  1258  				A string `json:"a"`
  1259  			}{A: "foo"}, B: struct {
  1260  				B string `json:"b"`
  1261  			}{B: "bar"}},
  1262  		},
  1263  		{
  1264  			name: "PtrHeadStringMultiFieldsNotRootOmitEmpty",
  1265  			data: &struct {
  1266  				A struct {
  1267  					A string `json:"a,omitempty"`
  1268  				}
  1269  				B struct {
  1270  					B string `json:"b,omitempty"`
  1271  				}
  1272  			}{A: struct {
  1273  				A string `json:"a,omitempty"`
  1274  			}{A: "foo"}, B: struct {
  1275  				B string `json:"b,omitempty"`
  1276  			}{B: "bar"}},
  1277  		},
  1278  		{
  1279  			name: "PtrHeadStringMultiFieldsNotRootString",
  1280  			data: &struct {
  1281  				A struct {
  1282  					A string `json:"a,string"`
  1283  				}
  1284  				B struct {
  1285  					B string `json:"b,string"`
  1286  				}
  1287  			}{A: struct {
  1288  				A string `json:"a,string"`
  1289  			}{A: "foo"}, B: struct {
  1290  				B string `json:"b,string"`
  1291  			}{B: "bar"}},
  1292  		},
  1293  		{
  1294  			name: "PtrHeadStringMultiFieldsNotRootStringOmitEmpty",
  1295  			data: &struct {
  1296  				A struct {
  1297  					A string `json:"a,string,omitempty"`
  1298  				}
  1299  				B struct {
  1300  					B string `json:"b,string,omitempty"`
  1301  				}
  1302  			}{A: struct {
  1303  				A string `json:"a,string,omitempty"`
  1304  			}{A: "foo"}, B: struct {
  1305  				B string `json:"b,string,omitempty"`
  1306  			}{B: "bar"}},
  1307  		},
  1308  
  1309  		// PtrHeadStringPtrMultiFieldsNotRoot
  1310  		{
  1311  			name: "PtrHeadStringPtrMultiFieldsNotRoot",
  1312  			data: &struct {
  1313  				A *struct {
  1314  					A *string `json:"a"`
  1315  				}
  1316  				B *struct {
  1317  					B *string `json:"b"`
  1318  				}
  1319  			}{A: &(struct {
  1320  				A *string `json:"a"`
  1321  			}{A: stringptr("foo")}), B: &(struct {
  1322  				B *string `json:"b"`
  1323  			}{B: stringptr("bar")})},
  1324  		},
  1325  		{
  1326  			name: "PtrHeadStringPtrMultiFieldsNotRootOmitEmpty",
  1327  			data: &struct {
  1328  				A *struct {
  1329  					A *string `json:"a,omitempty"`
  1330  				}
  1331  				B *struct {
  1332  					B *string `json:"b,omitempty"`
  1333  				}
  1334  			}{A: &(struct {
  1335  				A *string `json:"a,omitempty"`
  1336  			}{A: stringptr("foo")}), B: &(struct {
  1337  				B *string `json:"b,omitempty"`
  1338  			}{B: stringptr("bar")})},
  1339  		},
  1340  		{
  1341  			name: "PtrHeadStringPtrMultiFieldsNotRootString",
  1342  			data: &struct {
  1343  				A *struct {
  1344  					A *string `json:"a,string"`
  1345  				}
  1346  				B *struct {
  1347  					B *string `json:"b,string"`
  1348  				}
  1349  			}{A: &(struct {
  1350  				A *string `json:"a,string"`
  1351  			}{A: stringptr("foo")}), B: &(struct {
  1352  				B *string `json:"b,string"`
  1353  			}{B: stringptr("bar")})},
  1354  		},
  1355  		{
  1356  			name: "PtrHeadStringPtrMultiFieldsNotRootStringOmitEmpty",
  1357  			data: &struct {
  1358  				A *struct {
  1359  					A *string `json:"a,string,omitempty"`
  1360  				}
  1361  				B *struct {
  1362  					B *string `json:"b,string,omitempty"`
  1363  				}
  1364  			}{A: &(struct {
  1365  				A *string `json:"a,string,omitempty"`
  1366  			}{A: stringptr("foo")}), B: &(struct {
  1367  				B *string `json:"b,string,omitempty"`
  1368  			}{B: stringptr("bar")})},
  1369  		},
  1370  
  1371  		// PtrHeadStringPtrNilMultiFieldsNotRoot
  1372  		{
  1373  			name: "PtrHeadStringPtrNilMultiFieldsNotRoot",
  1374  			data: &struct {
  1375  				A *struct {
  1376  					A *string `json:"a"`
  1377  				}
  1378  				B *struct {
  1379  					B *string `json:"b"`
  1380  				}
  1381  			}{A: nil, B: nil},
  1382  		},
  1383  		{
  1384  			name: "PtrHeadStringPtrNilMultiFieldsNotRootOmitEmpty",
  1385  			data: &struct {
  1386  				A *struct {
  1387  					A *string `json:"a,omitempty"`
  1388  				}
  1389  				B *struct {
  1390  					B *string `json:"b,omitempty"`
  1391  				}
  1392  			}{A: nil, B: nil},
  1393  		},
  1394  		{
  1395  			name: "PtrHeadStringPtrNilMultiFieldsNotRootString",
  1396  			data: &struct {
  1397  				A *struct {
  1398  					A *string `json:"a,string"`
  1399  				}
  1400  				B *struct {
  1401  					B *string `json:"b,string"`
  1402  				}
  1403  			}{A: nil, B: nil},
  1404  		},
  1405  		{
  1406  			name: "PtrHeadStringPtrNilMultiFieldsNotRootStringOmitEmpty",
  1407  			data: &struct {
  1408  				A *struct {
  1409  					A *string `json:"a,string,omitempty"`
  1410  				}
  1411  				B *struct {
  1412  					B *string `json:"b,string,omitempty"`
  1413  				}
  1414  			}{A: nil, B: nil},
  1415  		},
  1416  
  1417  		// PtrHeadStringNilMultiFieldsNotRoot
  1418  		{
  1419  			name: "PtrHeadStringNilMultiFieldsNotRoot",
  1420  			data: (*struct {
  1421  				A *struct {
  1422  					A *string `json:"a"`
  1423  				}
  1424  				B *struct {
  1425  					B *string `json:"b"`
  1426  				}
  1427  			})(nil),
  1428  		},
  1429  		{
  1430  			name: "PtrHeadStringNilMultiFieldsNotRootOmitEmpty",
  1431  			data: (*struct {
  1432  				A *struct {
  1433  					A *string `json:"a,omitempty"`
  1434  				}
  1435  				B *struct {
  1436  					B *string `json:"b,omitempty"`
  1437  				}
  1438  			})(nil),
  1439  		},
  1440  		{
  1441  			name: "PtrHeadStringNilMultiFieldsNotRootString",
  1442  			data: (*struct {
  1443  				A *struct {
  1444  					A *string `json:"a,string"`
  1445  				}
  1446  				B *struct {
  1447  					B *string `json:"b,string"`
  1448  				}
  1449  			})(nil),
  1450  		},
  1451  		{
  1452  			name: "PtrHeadStringNilMultiFieldsNotRootStringOmitEmpty",
  1453  			data: (*struct {
  1454  				A *struct {
  1455  					A *string `json:"a,string,omitempty"`
  1456  				}
  1457  				B *struct {
  1458  					B *string `json:"b,string,omitempty"`
  1459  				}
  1460  			})(nil),
  1461  		},
  1462  
  1463  		// PtrHeadStringDoubleMultiFieldsNotRoot
  1464  		{
  1465  			name: "PtrHeadStringDoubleMultiFieldsNotRoot",
  1466  			data: &struct {
  1467  				A *struct {
  1468  					A string `json:"a"`
  1469  					B string `json:"b"`
  1470  					C string `json:"c"`
  1471  				}
  1472  				B *struct {
  1473  					A string `json:"a"`
  1474  					B string `json:"b"`
  1475  					C string `json:"c"`
  1476  				}
  1477  			}{A: &(struct {
  1478  				A string `json:"a"`
  1479  				B string `json:"b"`
  1480  				C string `json:"c"`
  1481  			}{A: "foo", B: "bar", C: "baz"}), B: &(struct {
  1482  				A string `json:"a"`
  1483  				B string `json:"b"`
  1484  				C string `json:"c"`
  1485  			}{A: "foo", B: "bar", C: "baz"})},
  1486  		},
  1487  		{
  1488  			name: "PtrHeadStringDoubleMultiFieldsNotRootOmitEmpty",
  1489  			data: &struct {
  1490  				A *struct {
  1491  					A string `json:"a,omitempty"`
  1492  					B string `json:"b,omitempty"`
  1493  				}
  1494  				B *struct {
  1495  					A string `json:"a,omitempty"`
  1496  					B string `json:"b,omitempty"`
  1497  				}
  1498  			}{A: &(struct {
  1499  				A string `json:"a,omitempty"`
  1500  				B string `json:"b,omitempty"`
  1501  			}{A: "foo", B: "bar"}), B: &(struct {
  1502  				A string `json:"a,omitempty"`
  1503  				B string `json:"b,omitempty"`
  1504  			}{A: "foo", B: "bar"})},
  1505  		},
  1506  		{
  1507  			name: "PtrHeadStringDoubleMultiFieldsNotRootString",
  1508  			data: &struct {
  1509  				A *struct {
  1510  					A string `json:"a,string"`
  1511  					B string `json:"b,string"`
  1512  				}
  1513  				B *struct {
  1514  					A string `json:"a,string"`
  1515  					B string `json:"b,string"`
  1516  				}
  1517  			}{A: &(struct {
  1518  				A string `json:"a,string"`
  1519  				B string `json:"b,string"`
  1520  			}{A: "foo", B: "bar"}), B: &(struct {
  1521  				A string `json:"a,string"`
  1522  				B string `json:"b,string"`
  1523  			}{A: "foo", B: "bar"})},
  1524  		},
  1525  		{
  1526  			name: "PtrHeadStringDoubleMultiFieldsNotRootStringOmitEmpty",
  1527  			data: &struct {
  1528  				A *struct {
  1529  					A string `json:"a,string,omitempty"`
  1530  					B string `json:"b,string,omitempty"`
  1531  				}
  1532  				B *struct {
  1533  					A string `json:"a,string,omitempty"`
  1534  					B string `json:"b,string,omitempty"`
  1535  				}
  1536  			}{A: &(struct {
  1537  				A string `json:"a,string,omitempty"`
  1538  				B string `json:"b,string,omitempty"`
  1539  			}{A: "foo", B: "bar"}), B: &(struct {
  1540  				A string `json:"a,string,omitempty"`
  1541  				B string `json:"b,string,omitempty"`
  1542  			}{A: "foo", B: "bar"})},
  1543  		},
  1544  
  1545  		// PtrHeadStringNilDoubleMultiFieldsNotRoot
  1546  		{
  1547  			name: "PtrHeadStringNilDoubleMultiFieldsNotRoot",
  1548  			data: &struct {
  1549  				A *struct {
  1550  					A string `json:"a"`
  1551  					B string `json:"b"`
  1552  				}
  1553  				B *struct {
  1554  					A string `json:"a"`
  1555  					B string `json:"b"`
  1556  				}
  1557  			}{A: nil, B: nil},
  1558  		},
  1559  		{
  1560  			name: "PtrHeadStringNilDoubleMultiFieldsNotRootOmitEmpty",
  1561  			data: &struct {
  1562  				A *struct {
  1563  					A string `json:"a,omitempty"`
  1564  					B string `json:"b,omitempty"`
  1565  				}
  1566  				B *struct {
  1567  					A string `json:"a,omitempty"`
  1568  					B string `json:"b,omitempty"`
  1569  				}
  1570  			}{A: nil, B: nil},
  1571  		},
  1572  		{
  1573  			name: "PtrHeadStringNilDoubleMultiFieldsNotRootString",
  1574  			data: &struct {
  1575  				A *struct {
  1576  					A string `json:"a,string"`
  1577  					B string `json:"b,string"`
  1578  				}
  1579  				B *struct {
  1580  					A string `json:"a,string"`
  1581  					B string `json:"b,string"`
  1582  				}
  1583  			}{A: nil, B: nil},
  1584  		},
  1585  		{
  1586  			name: "PtrHeadStringNilDoubleMultiFieldsNotRootStringOmitEmpty",
  1587  			data: &struct {
  1588  				A *struct {
  1589  					A string `json:"a,string,omitempty"`
  1590  					B string `json:"b,string,omitempty"`
  1591  				}
  1592  				B *struct {
  1593  					A string `json:"a,string,omitempty"`
  1594  					B string `json:"b,string,omitempty"`
  1595  				}
  1596  			}{A: nil, B: nil},
  1597  		},
  1598  
  1599  		// PtrHeadStringNilDoubleMultiFieldsNotRoot
  1600  		{
  1601  			name: "PtrHeadStringNilDoubleMultiFieldsNotRoot",
  1602  			data: (*struct {
  1603  				A *struct {
  1604  					A string `json:"a"`
  1605  					B string `json:"b"`
  1606  				}
  1607  				B *struct {
  1608  					A string `json:"a"`
  1609  					B string `json:"b"`
  1610  				}
  1611  			})(nil),
  1612  		},
  1613  		{
  1614  			name: "PtrHeadStringNilDoubleMultiFieldsNotRootOmitEmpty",
  1615  			data: (*struct {
  1616  				A *struct {
  1617  					A string `json:"a,omitempty"`
  1618  					B string `json:"b,omitempty"`
  1619  				}
  1620  				B *struct {
  1621  					A string `json:"a,omitempty"`
  1622  					B string `json:"b,omitempty"`
  1623  				}
  1624  			})(nil),
  1625  		},
  1626  		{
  1627  			name: "PtrHeadStringNilDoubleMultiFieldsNotRootString",
  1628  			data: (*struct {
  1629  				A *struct {
  1630  					A string `json:"a,string"`
  1631  					B string `json:"b,string"`
  1632  				}
  1633  				B *struct {
  1634  					A string `json:"a,string"`
  1635  					B string `json:"b,string"`
  1636  				}
  1637  			})(nil),
  1638  		},
  1639  		{
  1640  			name: "PtrHeadStringNilDoubleMultiFieldsNotRootStringOmitEmpty",
  1641  			data: (*struct {
  1642  				A *struct {
  1643  					A string `json:"a,string,omitempty"`
  1644  					B string `json:"b,string,omitempty"`
  1645  				}
  1646  				B *struct {
  1647  					A string `json:"a,string,omitempty"`
  1648  					B string `json:"b,string,omitempty"`
  1649  				}
  1650  			})(nil),
  1651  		},
  1652  
  1653  		// PtrHeadStringPtrDoubleMultiFieldsNotRoot
  1654  		{
  1655  			name: "PtrHeadStringPtrDoubleMultiFieldsNotRoot",
  1656  			data: &struct {
  1657  				A *struct {
  1658  					A *string `json:"a"`
  1659  					B *string `json:"b"`
  1660  				}
  1661  				B *struct {
  1662  					A *string `json:"a"`
  1663  					B *string `json:"b"`
  1664  				}
  1665  			}{A: &(struct {
  1666  				A *string `json:"a"`
  1667  				B *string `json:"b"`
  1668  			}{A: stringptr("foo"), B: stringptr("bar")}), B: &(struct {
  1669  				A *string `json:"a"`
  1670  				B *string `json:"b"`
  1671  			}{A: stringptr("foo"), B: stringptr("bar")})},
  1672  		},
  1673  		{
  1674  			name: "PtrHeadStringPtrDoubleMultiFieldsNotRootOmitEmpty",
  1675  			data: &struct {
  1676  				A *struct {
  1677  					A *string `json:"a,omitempty"`
  1678  					B *string `json:"b,omitempty"`
  1679  				}
  1680  				B *struct {
  1681  					A *string `json:"a,omitempty"`
  1682  					B *string `json:"b,omitempty"`
  1683  				}
  1684  			}{A: &(struct {
  1685  				A *string `json:"a,omitempty"`
  1686  				B *string `json:"b,omitempty"`
  1687  			}{A: stringptr("foo"), B: stringptr("bar")}), B: &(struct {
  1688  				A *string `json:"a,omitempty"`
  1689  				B *string `json:"b,omitempty"`
  1690  			}{A: stringptr("foo"), B: stringptr("bar")})},
  1691  		},
  1692  		{
  1693  			name: "PtrHeadStringPtrDoubleMultiFieldsNotRootString",
  1694  			data: &struct {
  1695  				A *struct {
  1696  					A *string `json:"a,string"`
  1697  					B *string `json:"b,string"`
  1698  				}
  1699  				B *struct {
  1700  					A *string `json:"a,string"`
  1701  					B *string `json:"b,string"`
  1702  				}
  1703  			}{A: &(struct {
  1704  				A *string `json:"a,string"`
  1705  				B *string `json:"b,string"`
  1706  			}{A: stringptr("foo"), B: stringptr("bar")}), B: &(struct {
  1707  				A *string `json:"a,string"`
  1708  				B *string `json:"b,string"`
  1709  			}{A: stringptr("foo"), B: stringptr("bar")})},
  1710  		},
  1711  		{
  1712  			name: "PtrHeadStringPtrDoubleMultiFieldsNotRootStringOmitEmpty",
  1713  			data: &struct {
  1714  				A *struct {
  1715  					A *string `json:"a,string,omitempty"`
  1716  					B *string `json:"b,string,omitempty"`
  1717  				}
  1718  				B *struct {
  1719  					A *string `json:"a,string,omitempty"`
  1720  					B *string `json:"b,string,omitempty"`
  1721  				}
  1722  			}{A: &(struct {
  1723  				A *string `json:"a,string,omitempty"`
  1724  				B *string `json:"b,string,omitempty"`
  1725  			}{A: stringptr("foo"), B: stringptr("bar")}), B: &(struct {
  1726  				A *string `json:"a,string,omitempty"`
  1727  				B *string `json:"b,string,omitempty"`
  1728  			}{A: stringptr("foo"), B: stringptr("bar")})},
  1729  		},
  1730  
  1731  		// PtrHeadStringPtrNilDoubleMultiFieldsNotRoot
  1732  		{
  1733  			name: "PtrHeadStringPtrNilDoubleMultiFieldsNotRoot",
  1734  			data: &struct {
  1735  				A *struct {
  1736  					A *string `json:"a"`
  1737  					B *string `json:"b"`
  1738  				}
  1739  				B *struct {
  1740  					A *string `json:"a"`
  1741  					B *string `json:"b"`
  1742  				}
  1743  			}{A: nil, B: nil},
  1744  		},
  1745  		{
  1746  			name: "PtrHeadStringPtrNilDoubleMultiFieldsNotRootOmitEmpty",
  1747  			data: &struct {
  1748  				A *struct {
  1749  					A *string `json:"a,omitempty"`
  1750  					B *string `json:"b,omitempty"`
  1751  				}
  1752  				B *struct {
  1753  					A *string `json:"a,omitempty"`
  1754  					B *string `json:"b,omitempty"`
  1755  				}
  1756  			}{A: nil, B: nil},
  1757  		},
  1758  		{
  1759  			name: "PtrHeadStringPtrNilDoubleMultiFieldsNotRootString",
  1760  			data: &struct {
  1761  				A *struct {
  1762  					A *string `json:"a,string"`
  1763  					B *string `json:"b,string"`
  1764  				}
  1765  				B *struct {
  1766  					A *string `json:"a,string"`
  1767  					B *string `json:"b,string"`
  1768  				}
  1769  			}{A: nil, B: nil},
  1770  		},
  1771  		{
  1772  			name: "PtrHeadStringPtrNilDoubleMultiFieldsNotRootStringOmitEmpty",
  1773  			data: &struct {
  1774  				A *struct {
  1775  					A *string `json:"a,string,omitempty"`
  1776  					B *string `json:"b,string,omitempty"`
  1777  				}
  1778  				B *struct {
  1779  					A *string `json:"a,string,omitempty"`
  1780  					B *string `json:"b,string,omitempty"`
  1781  				}
  1782  			}{A: nil, B: nil},
  1783  		},
  1784  
  1785  		// PtrHeadStringPtrNilDoubleMultiFieldsNotRoot
  1786  		{
  1787  			name: "PtrHeadStringPtrNilDoubleMultiFieldsNotRoot",
  1788  			data: (*struct {
  1789  				A *struct {
  1790  					A *string `json:"a"`
  1791  					B *string `json:"b"`
  1792  				}
  1793  				B *struct {
  1794  					A *string `json:"a"`
  1795  					B *string `json:"b"`
  1796  				}
  1797  			})(nil),
  1798  		},
  1799  		{
  1800  			name: "PtrHeadStringPtrNilDoubleMultiFieldsNotRootOmitEmpty",
  1801  			data: (*struct {
  1802  				A *struct {
  1803  					A *string `json:"a,omitempty"`
  1804  					B *string `json:"b,omitempty"`
  1805  				}
  1806  				B *struct {
  1807  					A *string `json:"a,omitempty"`
  1808  					B *string `json:"b,omitempty"`
  1809  				}
  1810  			})(nil),
  1811  		},
  1812  		{
  1813  			name: "PtrHeadStringPtrNilDoubleMultiFieldsNotRootString",
  1814  			data: (*struct {
  1815  				A *struct {
  1816  					A *string `json:"a,string"`
  1817  					B *string `json:"b,string"`
  1818  				}
  1819  				B *struct {
  1820  					A *string `json:"a,string"`
  1821  					B *string `json:"b,string"`
  1822  				}
  1823  			})(nil),
  1824  		},
  1825  		{
  1826  			name: "PtrHeadStringPtrNilDoubleMultiFieldsNotRootStringOmitEmpty",
  1827  			data: (*struct {
  1828  				A *struct {
  1829  					A *string `json:"a,string,omitempty"`
  1830  					B *string `json:"b,string,omitempty"`
  1831  				}
  1832  				B *struct {
  1833  					A *string `json:"a,string,omitempty"`
  1834  					B *string `json:"b,string,omitempty"`
  1835  				}
  1836  			})(nil),
  1837  		},
  1838  
  1839  		// AnonymousHeadString
  1840  		{
  1841  			name: "AnonymousHeadString",
  1842  			data: struct {
  1843  				structString
  1844  				B string `json:"b"`
  1845  			}{
  1846  				structString: structString{A: "foo"},
  1847  				B:            "bar",
  1848  			},
  1849  		},
  1850  		{
  1851  			name: "AnonymousHeadStringOmitEmpty",
  1852  			data: struct {
  1853  				structStringOmitEmpty
  1854  				B string `json:"b,omitempty"`
  1855  			}{
  1856  				structStringOmitEmpty: structStringOmitEmpty{A: "foo"},
  1857  				B:                     "bar",
  1858  			},
  1859  		},
  1860  		{
  1861  			name: "AnonymousHeadStringString",
  1862  			data: struct {
  1863  				structStringString
  1864  				B string `json:"b,string"`
  1865  			}{
  1866  				structStringString: structStringString{A: "foo"},
  1867  				B:                  "bar",
  1868  			},
  1869  		},
  1870  		{
  1871  			name: "AnonymousHeadStringStringOmitEmpty",
  1872  			data: struct {
  1873  				structStringStringOmitEmpty
  1874  				B string `json:"b,string,omitempty"`
  1875  			}{
  1876  				structStringStringOmitEmpty: structStringStringOmitEmpty{A: "foo"},
  1877  				B:                           "bar",
  1878  			},
  1879  		},
  1880  
  1881  		// PtrAnonymousHeadString
  1882  		{
  1883  			name: "PtrAnonymousHeadString",
  1884  			data: struct {
  1885  				*structString
  1886  				B string `json:"b"`
  1887  			}{
  1888  				structString: &structString{A: "foo"},
  1889  				B:            "bar",
  1890  			},
  1891  		},
  1892  		{
  1893  			name: "PtrAnonymousHeadStringOmitEmpty",
  1894  			data: struct {
  1895  				*structStringOmitEmpty
  1896  				B string `json:"b,omitempty"`
  1897  			}{
  1898  				structStringOmitEmpty: &structStringOmitEmpty{A: "foo"},
  1899  				B:                     "bar",
  1900  			},
  1901  		},
  1902  		{
  1903  			name: "PtrAnonymousHeadStringString",
  1904  			data: struct {
  1905  				*structStringString
  1906  				B string `json:"b,string"`
  1907  			}{
  1908  				structStringString: &structStringString{A: "foo"},
  1909  				B:                  "bar",
  1910  			},
  1911  		},
  1912  		{
  1913  			name: "PtrAnonymousHeadStringStringOmitEmpty",
  1914  			data: struct {
  1915  				*structStringStringOmitEmpty
  1916  				B string `json:"b,string,omitempty"`
  1917  			}{
  1918  				structStringStringOmitEmpty: &structStringStringOmitEmpty{A: "foo"},
  1919  				B:                           "bar",
  1920  			},
  1921  		},
  1922  
  1923  		// NilPtrAnonymousHeadString
  1924  		{
  1925  			name: "NilPtrAnonymousHeadString",
  1926  			data: struct {
  1927  				*structString
  1928  				B string `json:"b"`
  1929  			}{
  1930  				structString: nil,
  1931  				B:            "baz",
  1932  			},
  1933  		},
  1934  		{
  1935  			name: "NilPtrAnonymousHeadStringOmitEmpty",
  1936  			data: struct {
  1937  				*structStringOmitEmpty
  1938  				B string `json:"b,omitempty"`
  1939  			}{
  1940  				structStringOmitEmpty: nil,
  1941  				B:                     "baz",
  1942  			},
  1943  		},
  1944  		{
  1945  			name: "NilPtrAnonymousHeadStringString",
  1946  			data: struct {
  1947  				*structStringString
  1948  				B string `json:"b,string"`
  1949  			}{
  1950  				structStringString: nil,
  1951  				B:                  "baz",
  1952  			},
  1953  		},
  1954  		{
  1955  			name: "NilPtrAnonymousHeadStringStringOmitEmpty",
  1956  			data: struct {
  1957  				*structStringStringOmitEmpty
  1958  				B string `json:"b,string,omitempty"`
  1959  			}{
  1960  				structStringStringOmitEmpty: nil,
  1961  				B:                           "baz",
  1962  			},
  1963  		},
  1964  
  1965  		// AnonymousHeadStringPtr
  1966  		{
  1967  			name: "AnonymousHeadStringPtr",
  1968  			data: struct {
  1969  				structStringPtr
  1970  				B *string `json:"b"`
  1971  			}{
  1972  				structStringPtr: structStringPtr{A: stringptr("foo")},
  1973  				B:               stringptr("bar"),
  1974  			},
  1975  		},
  1976  		{
  1977  			name: "AnonymousHeadStringPtrOmitEmpty",
  1978  			data: struct {
  1979  				structStringPtrOmitEmpty
  1980  				B *string `json:"b,omitempty"`
  1981  			}{
  1982  				structStringPtrOmitEmpty: structStringPtrOmitEmpty{A: stringptr("foo")},
  1983  				B:                        stringptr("bar"),
  1984  			},
  1985  		},
  1986  		{
  1987  			name: "AnonymousHeadStringPtrString",
  1988  			data: struct {
  1989  				structStringPtrString
  1990  				B *string `json:"b,string"`
  1991  			}{
  1992  				structStringPtrString: structStringPtrString{A: stringptr("foo")},
  1993  				B:                     stringptr("bar"),
  1994  			},
  1995  		},
  1996  		{
  1997  			name: "AnonymousHeadStringPtrStringOmitEmpty",
  1998  			data: struct {
  1999  				structStringPtrStringOmitEmpty
  2000  				B *string `json:"b,string,omitempty"`
  2001  			}{
  2002  				structStringPtrStringOmitEmpty: structStringPtrStringOmitEmpty{A: stringptr("foo")},
  2003  				B:                              stringptr("bar"),
  2004  			},
  2005  		},
  2006  
  2007  		// AnonymousHeadStringPtrNil
  2008  		{
  2009  			name: "AnonymousHeadStringPtrNil",
  2010  			data: struct {
  2011  				structStringPtr
  2012  				B *string `json:"b"`
  2013  			}{
  2014  				structStringPtr: structStringPtr{A: nil},
  2015  				B:               stringptr("foo"),
  2016  			},
  2017  		},
  2018  		{
  2019  			name: "AnonymousHeadStringPtrNilOmitEmpty",
  2020  			data: struct {
  2021  				structStringPtrOmitEmpty
  2022  				B *string `json:"b,omitempty"`
  2023  			}{
  2024  				structStringPtrOmitEmpty: structStringPtrOmitEmpty{A: nil},
  2025  				B:                        stringptr("foo"),
  2026  			},
  2027  		},
  2028  		{
  2029  			name: "AnonymousHeadStringPtrNilString",
  2030  			data: struct {
  2031  				structStringPtrString
  2032  				B *string `json:"b,string"`
  2033  			}{
  2034  				structStringPtrString: structStringPtrString{A: nil},
  2035  				B:                     stringptr("foo"),
  2036  			},
  2037  		},
  2038  		{
  2039  			name: "AnonymousHeadStringPtrNilStringOmitEmpty",
  2040  			data: struct {
  2041  				structStringPtrStringOmitEmpty
  2042  				B *string `json:"b,string,omitempty"`
  2043  			}{
  2044  				structStringPtrStringOmitEmpty: structStringPtrStringOmitEmpty{A: nil},
  2045  				B:                              stringptr("foo"),
  2046  			},
  2047  		},
  2048  
  2049  		// PtrAnonymousHeadStringPtr
  2050  		{
  2051  			name: "PtrAnonymousHeadStringPtr",
  2052  			data: struct {
  2053  				*structStringPtr
  2054  				B *string `json:"b"`
  2055  			}{
  2056  				structStringPtr: &structStringPtr{A: stringptr("foo")},
  2057  				B:               stringptr("bar"),
  2058  			},
  2059  		},
  2060  		{
  2061  			name: "PtrAnonymousHeadStringPtrOmitEmpty",
  2062  			data: struct {
  2063  				*structStringPtrOmitEmpty
  2064  				B *string `json:"b,omitempty"`
  2065  			}{
  2066  				structStringPtrOmitEmpty: &structStringPtrOmitEmpty{A: stringptr("foo")},
  2067  				B:                        stringptr("bar"),
  2068  			},
  2069  		},
  2070  		{
  2071  			name: "PtrAnonymousHeadStringPtrString",
  2072  			data: struct {
  2073  				*structStringPtrString
  2074  				B *string `json:"b,string"`
  2075  			}{
  2076  				structStringPtrString: &structStringPtrString{A: stringptr("foo")},
  2077  				B:                     stringptr("bar"),
  2078  			},
  2079  		},
  2080  		{
  2081  			name: "PtrAnonymousHeadStringPtrStringOmitEmpty",
  2082  			data: struct {
  2083  				*structStringPtrStringOmitEmpty
  2084  				B *string `json:"b,string,omitempty"`
  2085  			}{
  2086  				structStringPtrStringOmitEmpty: &structStringPtrStringOmitEmpty{A: stringptr("foo")},
  2087  				B:                              stringptr("bar"),
  2088  			},
  2089  		},
  2090  
  2091  		// NilPtrAnonymousHeadStringPtr
  2092  		{
  2093  			name: "NilPtrAnonymousHeadStringPtr",
  2094  			data: struct {
  2095  				*structStringPtr
  2096  				B *string `json:"b"`
  2097  			}{
  2098  				structStringPtr: nil,
  2099  				B:               stringptr("foo"),
  2100  			},
  2101  		},
  2102  		{
  2103  			name: "NilPtrAnonymousHeadStringPtrOmitEmpty",
  2104  			data: struct {
  2105  				*structStringPtrOmitEmpty
  2106  				B *string `json:"b,omitempty"`
  2107  			}{
  2108  				structStringPtrOmitEmpty: nil,
  2109  				B:                        stringptr("foo"),
  2110  			},
  2111  		},
  2112  		{
  2113  			name: "NilPtrAnonymousHeadStringPtrString",
  2114  			data: struct {
  2115  				*structStringPtrString
  2116  				B *string `json:"b,string"`
  2117  			}{
  2118  				structStringPtrString: nil,
  2119  				B:                     stringptr("foo"),
  2120  			},
  2121  		},
  2122  		{
  2123  			name: "NilPtrAnonymousHeadStringPtrStringOmitEmpty",
  2124  			data: struct {
  2125  				*structStringPtrStringOmitEmpty
  2126  				B *string `json:"b,string,omitempty"`
  2127  			}{
  2128  				structStringPtrStringOmitEmpty: nil,
  2129  				B:                              stringptr("foo"),
  2130  			},
  2131  		},
  2132  
  2133  		// AnonymousHeadStringOnly
  2134  		{
  2135  			name: "AnonymousHeadStringOnly",
  2136  			data: struct {
  2137  				structString
  2138  			}{
  2139  				structString: structString{A: "foo"},
  2140  			},
  2141  		},
  2142  		{
  2143  			name: "AnonymousHeadStringOnlyOmitEmpty",
  2144  			data: struct {
  2145  				structStringOmitEmpty
  2146  			}{
  2147  				structStringOmitEmpty: structStringOmitEmpty{A: "foo"},
  2148  			},
  2149  		},
  2150  		{
  2151  			name: "AnonymousHeadStringOnlyString",
  2152  			data: struct {
  2153  				structStringString
  2154  			}{
  2155  				structStringString: structStringString{A: "foo"},
  2156  			},
  2157  		},
  2158  		{
  2159  			name: "AnonymousHeadStringOnlyStringOmitEmpty",
  2160  			data: struct {
  2161  				structStringStringOmitEmpty
  2162  			}{
  2163  				structStringStringOmitEmpty: structStringStringOmitEmpty{A: "foo"},
  2164  			},
  2165  		},
  2166  
  2167  		// PtrAnonymousHeadStringOnly
  2168  		{
  2169  			name: "PtrAnonymousHeadStringOnly",
  2170  			data: struct {
  2171  				*structString
  2172  			}{
  2173  				structString: &structString{A: "foo"},
  2174  			},
  2175  		},
  2176  		{
  2177  			name: "PtrAnonymousHeadStringOnlyOmitEmpty",
  2178  			data: struct {
  2179  				*structStringOmitEmpty
  2180  			}{
  2181  				structStringOmitEmpty: &structStringOmitEmpty{A: "foo"},
  2182  			},
  2183  		},
  2184  		{
  2185  			name: "PtrAnonymousHeadStringOnlyString",
  2186  			data: struct {
  2187  				*structStringString
  2188  			}{
  2189  				structStringString: &structStringString{A: "foo"},
  2190  			},
  2191  		},
  2192  		{
  2193  			name: "PtrAnonymousHeadStringOnlyStringOmitEmpty",
  2194  			data: struct {
  2195  				*structStringStringOmitEmpty
  2196  			}{
  2197  				structStringStringOmitEmpty: &structStringStringOmitEmpty{A: "foo"},
  2198  			},
  2199  		},
  2200  
  2201  		// NilPtrAnonymousHeadStringOnly
  2202  		{
  2203  			name: "NilPtrAnonymousHeadStringOnly",
  2204  			data: struct {
  2205  				*structString
  2206  			}{
  2207  				structString: nil,
  2208  			},
  2209  		},
  2210  		{
  2211  			name: "NilPtrAnonymousHeadStringOnlyOmitEmpty",
  2212  			data: struct {
  2213  				*structStringOmitEmpty
  2214  			}{
  2215  				structStringOmitEmpty: nil,
  2216  			},
  2217  		},
  2218  		{
  2219  			name: "NilPtrAnonymousHeadStringOnlyString",
  2220  			data: struct {
  2221  				*structStringString
  2222  			}{
  2223  				structStringString: nil,
  2224  			},
  2225  		},
  2226  		{
  2227  			name: "NilPtrAnonymousHeadStringOnlyStringOmitEmpty",
  2228  			data: struct {
  2229  				*structStringStringOmitEmpty
  2230  			}{
  2231  				structStringStringOmitEmpty: nil,
  2232  			},
  2233  		},
  2234  
  2235  		// AnonymousHeadStringPtrOnly
  2236  		{
  2237  			name: "AnonymousHeadStringPtrOnly",
  2238  			data: struct {
  2239  				structStringPtr
  2240  			}{
  2241  				structStringPtr: structStringPtr{A: stringptr("foo")},
  2242  			},
  2243  		},
  2244  		{
  2245  			name: "AnonymousHeadStringPtrOnlyOmitEmpty",
  2246  			data: struct {
  2247  				structStringPtrOmitEmpty
  2248  			}{
  2249  				structStringPtrOmitEmpty: structStringPtrOmitEmpty{A: stringptr("foo")},
  2250  			},
  2251  		},
  2252  		{
  2253  			name: "AnonymousHeadStringPtrOnlyString",
  2254  			data: struct {
  2255  				structStringPtrString
  2256  			}{
  2257  				structStringPtrString: structStringPtrString{A: stringptr("foo")},
  2258  			},
  2259  		},
  2260  		{
  2261  			name: "AnonymousHeadStringPtrOnlyStringOmitEmpty",
  2262  			data: struct {
  2263  				structStringPtrStringOmitEmpty
  2264  			}{
  2265  				structStringPtrStringOmitEmpty: structStringPtrStringOmitEmpty{A: stringptr("foo")},
  2266  			},
  2267  		},
  2268  
  2269  		// AnonymousHeadStringPtrNilOnly
  2270  		{
  2271  			name: "AnonymousHeadStringPtrNilOnly",
  2272  			data: struct {
  2273  				structStringPtr
  2274  			}{
  2275  				structStringPtr: structStringPtr{A: nil},
  2276  			},
  2277  		},
  2278  		{
  2279  			name: "AnonymousHeadStringPtrNilOnlyOmitEmpty",
  2280  			data: struct {
  2281  				structStringPtrOmitEmpty
  2282  			}{
  2283  				structStringPtrOmitEmpty: structStringPtrOmitEmpty{A: nil},
  2284  			},
  2285  		},
  2286  		{
  2287  			name: "AnonymousHeadStringPtrNilOnlyString",
  2288  			data: struct {
  2289  				structStringPtrString
  2290  			}{
  2291  				structStringPtrString: structStringPtrString{A: nil},
  2292  			},
  2293  		},
  2294  		{
  2295  			name: "AnonymousHeadStringPtrNilOnlyStringOmitEmpty",
  2296  			data: struct {
  2297  				structStringPtrStringOmitEmpty
  2298  			}{
  2299  				structStringPtrStringOmitEmpty: structStringPtrStringOmitEmpty{A: nil},
  2300  			},
  2301  		},
  2302  
  2303  		// PtrAnonymousHeadStringPtrOnly
  2304  		{
  2305  			name: "PtrAnonymousHeadStringPtrOnly",
  2306  			data: struct {
  2307  				*structStringPtr
  2308  			}{
  2309  				structStringPtr: &structStringPtr{A: stringptr("foo")},
  2310  			},
  2311  		},
  2312  		{
  2313  			name: "PtrAnonymousHeadStringPtrOnlyOmitEmpty",
  2314  			data: struct {
  2315  				*structStringPtrOmitEmpty
  2316  			}{
  2317  				structStringPtrOmitEmpty: &structStringPtrOmitEmpty{A: stringptr("foo")},
  2318  			},
  2319  		},
  2320  		{
  2321  			name: "PtrAnonymousHeadStringPtrOnlyString",
  2322  			data: struct {
  2323  				*structStringPtrString
  2324  			}{
  2325  				structStringPtrString: &structStringPtrString{A: stringptr("foo")},
  2326  			},
  2327  		},
  2328  		{
  2329  			name: "PtrAnonymousHeadStringPtrOnlyStringOmitEmpty",
  2330  			data: struct {
  2331  				*structStringPtrStringOmitEmpty
  2332  			}{
  2333  				structStringPtrStringOmitEmpty: &structStringPtrStringOmitEmpty{A: stringptr("foo")},
  2334  			},
  2335  		},
  2336  
  2337  		// NilPtrAnonymousHeadStringPtrOnly
  2338  		{
  2339  			name: "NilPtrAnonymousHeadStringPtrOnly",
  2340  			data: struct {
  2341  				*structStringPtr
  2342  			}{
  2343  				structStringPtr: nil,
  2344  			},
  2345  		},
  2346  		{
  2347  			name: "NilPtrAnonymousHeadStringPtrOnlyOmitEmpty",
  2348  			data: struct {
  2349  				*structStringPtrOmitEmpty
  2350  			}{
  2351  				structStringPtrOmitEmpty: nil,
  2352  			},
  2353  		},
  2354  		{
  2355  			name: "NilPtrAnonymousHeadStringPtrOnlyString",
  2356  			data: struct {
  2357  				*structStringPtrString
  2358  			}{
  2359  				structStringPtrString: nil,
  2360  			},
  2361  		},
  2362  		{
  2363  			name: "NilPtrAnonymousHeadStringPtrOnlyStringOmitEmpty",
  2364  			data: struct {
  2365  				*structStringPtrStringOmitEmpty
  2366  			}{
  2367  				structStringPtrStringOmitEmpty: nil,
  2368  			},
  2369  		},
  2370  	}
  2371  	for _, test := range tests {
  2372  		for _, indent := range []bool{true, false} {
  2373  			for _, htmlEscape := range []bool{true, false} {
  2374  				t.Run(fmt.Sprintf("%s_indent_%t_escape_%t", test.name, indent, htmlEscape), func(t *testing.T) {
  2375  					var buf bytes.Buffer
  2376  					enc := json.NewEncoder(&buf)
  2377  					enc.SetEscapeHTML(htmlEscape)
  2378  					if indent {
  2379  						enc.SetIndent("", "  ")
  2380  					}
  2381  					if err := enc.Encode(test.data); err != nil {
  2382  						t.Fatalf("%s(htmlEscape:%v,indent:%v): %v: %s", test.name, htmlEscape, indent, test.data, err)
  2383  					}
  2384  					stdresult := encodeByEncodingJSON(test.data, indent, htmlEscape)
  2385  					if buf.String() != stdresult {
  2386  						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())
  2387  					}
  2388  				})
  2389  			}
  2390  		}
  2391  	}
  2392  }