github.com/night-codes/go-json@v0.9.15/test/cover/cover_int_test.go (about)

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