git.gammaspectra.live/P2Pool/go-json@v0.99.0/test/cover/cover_int64_test.go (about)

     1  package json_test
     2  
     3  import (
     4  	"bytes"
     5  	"fmt"
     6  	"testing"
     7  
     8  	"git.gammaspectra.live/P2Pool/go-json"
     9  )
    10  
    11  func TestCoverInt64(t *testing.T) {
    12  	type structInt64 struct {
    13  		A int64 `json:"a"`
    14  	}
    15  	type structInt64OmitEmpty struct {
    16  		A int64 `json:"a,omitempty"`
    17  	}
    18  	type structInt64String struct {
    19  		A int64 `json:"a,string"`
    20  	}
    21  
    22  	type structInt64Ptr struct {
    23  		A *int64 `json:"a"`
    24  	}
    25  	type structInt64PtrOmitEmpty struct {
    26  		A *int64 `json:"a,omitempty"`
    27  	}
    28  	type structInt64PtrString struct {
    29  		A *int64 `json:"a,string"`
    30  	}
    31  
    32  	tests := []struct {
    33  		name string
    34  		data interface{}
    35  	}{
    36  		{
    37  			name: "Int64",
    38  			data: int64(10),
    39  		},
    40  		{
    41  			name: "Int64Ptr",
    42  			data: int64ptr(10),
    43  		},
    44  		{
    45  			name: "Int64Ptr3",
    46  			data: int64ptr3(10),
    47  		},
    48  		{
    49  			name: "Int64PtrNil",
    50  			data: (*int64)(nil),
    51  		},
    52  		{
    53  			name: "Int64Ptr3Nil",
    54  			data: (***int64)(nil),
    55  		},
    56  
    57  		// HeadInt64Zero
    58  		{
    59  			name: "HeadInt64Zero",
    60  			data: struct {
    61  				A int64 `json:"a"`
    62  			}{},
    63  		},
    64  		{
    65  			name: "HeadInt64ZeroOmitEmpty",
    66  			data: struct {
    67  				A int64 `json:"a,omitempty"`
    68  			}{},
    69  		},
    70  		{
    71  			name: "HeadInt64ZeroString",
    72  			data: struct {
    73  				A int64 `json:"a,string"`
    74  			}{},
    75  		},
    76  
    77  		// HeadInt64
    78  		{
    79  			name: "HeadInt64",
    80  			data: struct {
    81  				A int64 `json:"a"`
    82  			}{A: -1},
    83  		},
    84  		{
    85  			name: "HeadInt64OmitEmpty",
    86  			data: struct {
    87  				A int64 `json:"a,omitempty"`
    88  			}{A: -1},
    89  		},
    90  		{
    91  			name: "HeadInt64String",
    92  			data: struct {
    93  				A int64 `json:"a,string"`
    94  			}{A: -1},
    95  		},
    96  
    97  		// HeadInt64Ptr
    98  		{
    99  			name: "HeadInt64Ptr",
   100  			data: struct {
   101  				A *int64 `json:"a"`
   102  			}{A: int64ptr(-1)},
   103  		},
   104  		{
   105  			name: "HeadInt64PtrOmitEmpty",
   106  			data: struct {
   107  				A *int64 `json:"a,omitempty"`
   108  			}{A: int64ptr(-1)},
   109  		},
   110  		{
   111  			name: "HeadInt64PtrString",
   112  			data: struct {
   113  				A *int64 `json:"a,string"`
   114  			}{A: int64ptr(-1)},
   115  		},
   116  
   117  		// HeadInt64PtrNil
   118  		{
   119  			name: "HeadInt64PtrNil",
   120  			data: struct {
   121  				A *int64 `json:"a"`
   122  			}{A: nil},
   123  		},
   124  		{
   125  			name: "HeadInt64PtrNilOmitEmpty",
   126  			data: struct {
   127  				A *int64 `json:"a,omitempty"`
   128  			}{A: nil},
   129  		},
   130  		{
   131  			name: "HeadInt64PtrNilString",
   132  			data: struct {
   133  				A *int64 `json:"a,string"`
   134  			}{A: nil},
   135  		},
   136  
   137  		// PtrHeadInt64Zero
   138  		{
   139  			name: "PtrHeadInt64Zero",
   140  			data: &struct {
   141  				A int64 `json:"a"`
   142  			}{},
   143  		},
   144  		{
   145  			name: "PtrHeadInt64ZeroOmitEmpty",
   146  			data: &struct {
   147  				A int64 `json:"a,omitempty"`
   148  			}{},
   149  		},
   150  		{
   151  			name: "PtrHeadInt64ZeroString",
   152  			data: &struct {
   153  				A int64 `json:"a,string"`
   154  			}{},
   155  		},
   156  
   157  		// PtrHeadInt64
   158  		{
   159  			name: "PtrHeadInt64",
   160  			data: &struct {
   161  				A int64 `json:"a"`
   162  			}{A: -1},
   163  		},
   164  		{
   165  			name: "PtrHeadInt64OmitEmpty",
   166  			data: &struct {
   167  				A int64 `json:"a,omitempty"`
   168  			}{A: -1},
   169  		},
   170  		{
   171  			name: "PtrHeadInt64String",
   172  			data: &struct {
   173  				A int64 `json:"a,string"`
   174  			}{A: -1},
   175  		},
   176  
   177  		// PtrHeadInt64Ptr
   178  		{
   179  			name: "PtrHeadInt64Ptr",
   180  			data: &struct {
   181  				A *int64 `json:"a"`
   182  			}{A: int64ptr(-1)},
   183  		},
   184  		{
   185  			name: "PtrHeadInt64PtrOmitEmpty",
   186  			data: &struct {
   187  				A *int64 `json:"a,omitempty"`
   188  			}{A: int64ptr(-1)},
   189  		},
   190  		{
   191  			name: "PtrHeadInt64PtrString",
   192  			data: &struct {
   193  				A *int64 `json:"a,string"`
   194  			}{A: int64ptr(-1)},
   195  		},
   196  
   197  		// PtrHeadInt64PtrNil
   198  		{
   199  			name: "PtrHeadInt64PtrNil",
   200  			data: &struct {
   201  				A *int64 `json:"a"`
   202  			}{A: nil},
   203  		},
   204  		{
   205  			name: "PtrHeadInt64PtrNilOmitEmpty",
   206  			data: &struct {
   207  				A *int64 `json:"a,omitempty"`
   208  			}{A: nil},
   209  		},
   210  		{
   211  			name: "PtrHeadInt64PtrNilString",
   212  			data: &struct {
   213  				A *int64 `json:"a,string"`
   214  			}{A: nil},
   215  		},
   216  
   217  		// PtrHeadInt64Nil
   218  		{
   219  			name: "PtrHeadInt64Nil",
   220  			data: (*struct {
   221  				A *int64 `json:"a"`
   222  			})(nil),
   223  		},
   224  		{
   225  			name: "PtrHeadInt64NilOmitEmpty",
   226  			data: (*struct {
   227  				A *int64 `json:"a,omitempty"`
   228  			})(nil),
   229  		},
   230  		{
   231  			name: "PtrHeadInt64NilString",
   232  			data: (*struct {
   233  				A *int64 `json:"a,string"`
   234  			})(nil),
   235  		},
   236  
   237  		// HeadInt64ZeroMultiFields
   238  		{
   239  			name: "HeadInt64ZeroMultiFields",
   240  			data: struct {
   241  				A int64 `json:"a"`
   242  				B int64 `json:"b"`
   243  				C int64 `json:"c"`
   244  			}{},
   245  		},
   246  		{
   247  			name: "HeadInt64ZeroMultiFieldsOmitEmpty",
   248  			data: struct {
   249  				A int64 `json:"a,omitempty"`
   250  				B int64 `json:"b,omitempty"`
   251  				C int64 `json:"c,omitempty"`
   252  			}{},
   253  		},
   254  		{
   255  			name: "HeadInt64ZeroMultiFields",
   256  			data: struct {
   257  				A int64 `json:"a,string"`
   258  				B int64 `json:"b,string"`
   259  				C int64 `json:"c,string"`
   260  			}{},
   261  		},
   262  
   263  		// HeadInt64MultiFields
   264  		{
   265  			name: "HeadInt64MultiFields",
   266  			data: struct {
   267  				A int64 `json:"a"`
   268  				B int64 `json:"b"`
   269  				C int64 `json:"c"`
   270  			}{A: -1, B: 2, C: 3},
   271  		},
   272  		{
   273  			name: "HeadInt64MultiFieldsOmitEmpty",
   274  			data: struct {
   275  				A int64 `json:"a,omitempty"`
   276  				B int64 `json:"b,omitempty"`
   277  				C int64 `json:"c,omitempty"`
   278  			}{A: -1, B: 2, C: 3},
   279  		},
   280  		{
   281  			name: "HeadInt64MultiFieldsString",
   282  			data: struct {
   283  				A int64 `json:"a,string"`
   284  				B int64 `json:"b,string"`
   285  				C int64 `json:"c,string"`
   286  			}{A: -1, B: 2, C: 3},
   287  		},
   288  
   289  		// HeadInt64PtrMultiFields
   290  		{
   291  			name: "HeadInt64PtrMultiFields",
   292  			data: struct {
   293  				A *int64 `json:"a"`
   294  				B *int64 `json:"b"`
   295  				C *int64 `json:"c"`
   296  			}{A: int64ptr(-1), B: int64ptr(2), C: int64ptr(3)},
   297  		},
   298  		{
   299  			name: "HeadInt64PtrMultiFieldsOmitEmpty",
   300  			data: struct {
   301  				A *int64 `json:"a,omitempty"`
   302  				B *int64 `json:"b,omitempty"`
   303  				C *int64 `json:"c,omitempty"`
   304  			}{A: int64ptr(-1), B: int64ptr(2), C: int64ptr(3)},
   305  		},
   306  		{
   307  			name: "HeadInt64PtrMultiFieldsString",
   308  			data: struct {
   309  				A *int64 `json:"a,string"`
   310  				B *int64 `json:"b,string"`
   311  				C *int64 `json:"c,string"`
   312  			}{A: int64ptr(-1), B: int64ptr(2), C: int64ptr(3)},
   313  		},
   314  
   315  		// HeadInt64PtrNilMultiFields
   316  		{
   317  			name: "HeadInt64PtrNilMultiFields",
   318  			data: struct {
   319  				A *int64 `json:"a"`
   320  				B *int64 `json:"b"`
   321  				C *int64 `json:"c"`
   322  			}{A: nil, B: nil, C: nil},
   323  		},
   324  		{
   325  			name: "HeadInt64PtrNilMultiFieldsOmitEmpty",
   326  			data: struct {
   327  				A *int64 `json:"a,omitempty"`
   328  				B *int64 `json:"b,omitempty"`
   329  				C *int64 `json:"c,omitempty"`
   330  			}{A: nil, B: nil, C: nil},
   331  		},
   332  		{
   333  			name: "HeadInt64PtrNilMultiFieldsString",
   334  			data: struct {
   335  				A *int64 `json:"a,string"`
   336  				B *int64 `json:"b,string"`
   337  				C *int64 `json:"c,string"`
   338  			}{A: nil, B: nil, C: nil},
   339  		},
   340  
   341  		// PtrHeadInt64ZeroMultiFields
   342  		{
   343  			name: "PtrHeadInt64ZeroMultiFields",
   344  			data: &struct {
   345  				A int64 `json:"a"`
   346  				B int64 `json:"b"`
   347  			}{},
   348  		},
   349  		{
   350  			name: "PtrHeadInt64ZeroMultiFieldsOmitEmpty",
   351  			data: &struct {
   352  				A int64 `json:"a,omitempty"`
   353  				B int64 `json:"b,omitempty"`
   354  			}{},
   355  		},
   356  		{
   357  			name: "PtrHeadInt64ZeroMultiFieldsString",
   358  			data: &struct {
   359  				A int64 `json:"a,string"`
   360  				B int64 `json:"b,string"`
   361  			}{},
   362  		},
   363  
   364  		// PtrHeadInt64MultiFields
   365  		{
   366  			name: "PtrHeadInt64MultiFields",
   367  			data: &struct {
   368  				A int64 `json:"a"`
   369  				B int64 `json:"b"`
   370  			}{A: -1, B: 2},
   371  		},
   372  		{
   373  			name: "PtrHeadInt64MultiFieldsOmitEmpty",
   374  			data: &struct {
   375  				A int64 `json:"a,omitempty"`
   376  				B int64 `json:"b,omitempty"`
   377  			}{A: -1, B: 2},
   378  		},
   379  		{
   380  			name: "PtrHeadInt64MultiFieldsString",
   381  			data: &struct {
   382  				A int64 `json:"a,string"`
   383  				B int64 `json:"b,string"`
   384  			}{A: -1, B: 2},
   385  		},
   386  
   387  		// PtrHeadInt64PtrMultiFields
   388  		{
   389  			name: "PtrHeadInt64PtrMultiFields",
   390  			data: &struct {
   391  				A *int64 `json:"a"`
   392  				B *int64 `json:"b"`
   393  			}{A: int64ptr(-1), B: int64ptr(2)},
   394  		},
   395  		{
   396  			name: "PtrHeadInt64PtrMultiFieldsOmitEmpty",
   397  			data: &struct {
   398  				A *int64 `json:"a,omitempty"`
   399  				B *int64 `json:"b,omitempty"`
   400  			}{A: int64ptr(-1), B: int64ptr(2)},
   401  		},
   402  		{
   403  			name: "PtrHeadInt64PtrMultiFieldsString",
   404  			data: &struct {
   405  				A *int64 `json:"a,string"`
   406  				B *int64 `json:"b,string"`
   407  			}{A: int64ptr(-1), B: int64ptr(2)},
   408  		},
   409  
   410  		// PtrHeadInt64PtrNilMultiFields
   411  		{
   412  			name: "PtrHeadInt64PtrNilMultiFields",
   413  			data: &struct {
   414  				A *int64 `json:"a"`
   415  				B *int64 `json:"b"`
   416  			}{A: nil, B: nil},
   417  		},
   418  		{
   419  			name: "PtrHeadInt64PtrNilMultiFieldsOmitEmpty",
   420  			data: &struct {
   421  				A *int64 `json:"a,omitempty"`
   422  				B *int64 `json:"b,omitempty"`
   423  			}{A: nil, B: nil},
   424  		},
   425  		{
   426  			name: "PtrHeadInt64PtrNilMultiFieldsString",
   427  			data: &struct {
   428  				A *int64 `json:"a,string"`
   429  				B *int64 `json:"b,string"`
   430  			}{A: nil, B: nil},
   431  		},
   432  
   433  		// PtrHeadInt64NilMultiFields
   434  		{
   435  			name: "PtrHeadInt64NilMultiFields",
   436  			data: (*struct {
   437  				A *int64 `json:"a"`
   438  				B *int64 `json:"b"`
   439  			})(nil),
   440  		},
   441  		{
   442  			name: "PtrHeadInt64NilMultiFieldsOmitEmpty",
   443  			data: (*struct {
   444  				A *int64 `json:"a,omitempty"`
   445  				B *int64 `json:"b,omitempty"`
   446  			})(nil),
   447  		},
   448  		{
   449  			name: "PtrHeadInt64NilMultiFieldsString",
   450  			data: (*struct {
   451  				A *int64 `json:"a,string"`
   452  				B *int64 `json:"b,string"`
   453  			})(nil),
   454  		},
   455  
   456  		// HeadInt64ZeroNotRoot
   457  		{
   458  			name: "HeadInt64ZeroNotRoot",
   459  			data: struct {
   460  				A struct {
   461  					A int64 `json:"a"`
   462  				}
   463  			}{},
   464  		},
   465  		{
   466  			name: "HeadInt64ZeroNotRootOmitEmpty",
   467  			data: struct {
   468  				A struct {
   469  					A int64 `json:"a,omitempty"`
   470  				}
   471  			}{},
   472  		},
   473  		{
   474  			name: "HeadInt64ZeroNotRootString",
   475  			data: struct {
   476  				A struct {
   477  					A int64 `json:"a,string"`
   478  				}
   479  			}{},
   480  		},
   481  
   482  		// HeadInt64NotRoot
   483  		{
   484  			name: "HeadInt64NotRoot",
   485  			data: struct {
   486  				A struct {
   487  					A int64 `json:"a"`
   488  				}
   489  			}{A: struct {
   490  				A int64 `json:"a"`
   491  			}{A: -1}},
   492  		},
   493  		{
   494  			name: "HeadInt64NotRootOmitEmpty",
   495  			data: struct {
   496  				A struct {
   497  					A int64 `json:"a,omitempty"`
   498  				}
   499  			}{A: struct {
   500  				A int64 `json:"a,omitempty"`
   501  			}{A: -1}},
   502  		},
   503  		{
   504  			name: "HeadInt64NotRootString",
   505  			data: struct {
   506  				A struct {
   507  					A int64 `json:"a,string"`
   508  				}
   509  			}{A: struct {
   510  				A int64 `json:"a,string"`
   511  			}{A: -1}},
   512  		},
   513  
   514  		// HeadInt64PtrNotRoot
   515  		{
   516  			name: "HeadInt64PtrNotRoot",
   517  			data: struct {
   518  				A struct {
   519  					A *int64 `json:"a"`
   520  				}
   521  			}{A: struct {
   522  				A *int64 `json:"a"`
   523  			}{int64ptr(-1)}},
   524  		},
   525  		{
   526  			name: "HeadInt64PtrNotRootOmitEmpty",
   527  			data: struct {
   528  				A struct {
   529  					A *int64 `json:"a,omitempty"`
   530  				}
   531  			}{A: struct {
   532  				A *int64 `json:"a,omitempty"`
   533  			}{int64ptr(-1)}},
   534  		},
   535  		{
   536  			name: "HeadInt64PtrNotRootString",
   537  			data: struct {
   538  				A struct {
   539  					A *int64 `json:"a,string"`
   540  				}
   541  			}{A: struct {
   542  				A *int64 `json:"a,string"`
   543  			}{int64ptr(-1)}},
   544  		},
   545  
   546  		// HeadInt64PtrNilNotRoot
   547  		{
   548  			name: "HeadInt64PtrNilNotRoot",
   549  			data: struct {
   550  				A struct {
   551  					A *int64 `json:"a"`
   552  				}
   553  			}{},
   554  		},
   555  		{
   556  			name: "HeadInt64PtrNilNotRootOmitEmpty",
   557  			data: struct {
   558  				A struct {
   559  					A *int64 `json:"a,omitempty"`
   560  				}
   561  			}{},
   562  		},
   563  		{
   564  			name: "HeadInt64PtrNilNotRootString",
   565  			data: struct {
   566  				A struct {
   567  					A *int64 `json:"a,string"`
   568  				}
   569  			}{},
   570  		},
   571  
   572  		// PtrHeadInt64ZeroNotRoot
   573  		{
   574  			name: "PtrHeadInt64ZeroNotRoot",
   575  			data: struct {
   576  				A *struct {
   577  					A int64 `json:"a"`
   578  				}
   579  			}{A: new(struct {
   580  				A int64 `json:"a"`
   581  			})},
   582  		},
   583  		{
   584  			name: "PtrHeadInt64ZeroNotRootOmitEmpty",
   585  			data: struct {
   586  				A *struct {
   587  					A int64 `json:"a,omitempty"`
   588  				}
   589  			}{A: new(struct {
   590  				A int64 `json:"a,omitempty"`
   591  			})},
   592  		},
   593  		{
   594  			name: "PtrHeadInt64ZeroNotRootString",
   595  			data: struct {
   596  				A *struct {
   597  					A int64 `json:"a,string"`
   598  				}
   599  			}{A: new(struct {
   600  				A int64 `json:"a,string"`
   601  			})},
   602  		},
   603  
   604  		// PtrHeadInt64NotRoot
   605  		{
   606  			name: "PtrHeadInt64NotRoot",
   607  			data: struct {
   608  				A *struct {
   609  					A int64 `json:"a"`
   610  				}
   611  			}{A: &(struct {
   612  				A int64 `json:"a"`
   613  			}{A: -1})},
   614  		},
   615  		{
   616  			name: "PtrHeadInt64NotRootOmitEmpty",
   617  			data: struct {
   618  				A *struct {
   619  					A int64 `json:"a,omitempty"`
   620  				}
   621  			}{A: &(struct {
   622  				A int64 `json:"a,omitempty"`
   623  			}{A: -1})},
   624  		},
   625  		{
   626  			name: "PtrHeadInt64NotRootString",
   627  			data: struct {
   628  				A *struct {
   629  					A int64 `json:"a,string"`
   630  				}
   631  			}{A: &(struct {
   632  				A int64 `json:"a,string"`
   633  			}{A: -1})},
   634  		},
   635  
   636  		// PtrHeadInt64PtrNotRoot
   637  		{
   638  			name: "PtrHeadInt64PtrNotRoot",
   639  			data: struct {
   640  				A *struct {
   641  					A *int64 `json:"a"`
   642  				}
   643  			}{A: &(struct {
   644  				A *int64 `json:"a"`
   645  			}{A: int64ptr(-1)})},
   646  		},
   647  		{
   648  			name: "PtrHeadInt64PtrNotRootOmitEmpty",
   649  			data: struct {
   650  				A *struct {
   651  					A *int64 `json:"a,omitempty"`
   652  				}
   653  			}{A: &(struct {
   654  				A *int64 `json:"a,omitempty"`
   655  			}{A: int64ptr(-1)})},
   656  		},
   657  		{
   658  			name: "PtrHeadInt64PtrNotRootString",
   659  			data: struct {
   660  				A *struct {
   661  					A *int64 `json:"a,string"`
   662  				}
   663  			}{A: &(struct {
   664  				A *int64 `json:"a,string"`
   665  			}{A: int64ptr(-1)})},
   666  		},
   667  
   668  		// PtrHeadInt64PtrNilNotRoot
   669  		{
   670  			name: "PtrHeadInt64PtrNilNotRoot",
   671  			data: struct {
   672  				A *struct {
   673  					A *int64 `json:"a"`
   674  				}
   675  			}{A: &(struct {
   676  				A *int64 `json:"a"`
   677  			}{A: nil})},
   678  		},
   679  		{
   680  			name: "PtrHeadInt64PtrNilNotRootOmitEmpty",
   681  			data: struct {
   682  				A *struct {
   683  					A *int64 `json:"a,omitempty"`
   684  				}
   685  			}{A: &(struct {
   686  				A *int64 `json:"a,omitempty"`
   687  			}{A: nil})},
   688  		},
   689  		{
   690  			name: "PtrHeadInt64PtrNilNotRootString",
   691  			data: struct {
   692  				A *struct {
   693  					A *int64 `json:"a,string"`
   694  				}
   695  			}{A: &(struct {
   696  				A *int64 `json:"a,string"`
   697  			}{A: nil})},
   698  		},
   699  
   700  		// PtrHeadInt64NilNotRoot
   701  		{
   702  			name: "PtrHeadInt64NilNotRoot",
   703  			data: struct {
   704  				A *struct {
   705  					A *int64 `json:"a"`
   706  				}
   707  			}{A: nil},
   708  		},
   709  		{
   710  			name: "PtrHeadInt64NilNotRootOmitEmpty",
   711  			data: struct {
   712  				A *struct {
   713  					A *int64 `json:"a,omitempty"`
   714  				} `json:",omitempty"`
   715  			}{A: nil},
   716  		},
   717  		{
   718  			name: "PtrHeadInt64NilNotRootString",
   719  			data: struct {
   720  				A *struct {
   721  					A *int64 `json:"a,string"`
   722  				} `json:",string"`
   723  			}{A: nil},
   724  		},
   725  
   726  		// HeadInt64ZeroMultiFieldsNotRoot
   727  		{
   728  			name: "HeadInt64ZeroMultiFieldsNotRoot",
   729  			data: struct {
   730  				A struct {
   731  					A int64 `json:"a"`
   732  				}
   733  				B struct {
   734  					B int64 `json:"b"`
   735  				}
   736  			}{},
   737  		},
   738  		{
   739  			name: "HeadInt64ZeroMultiFieldsNotRootOmitEmpty",
   740  			data: struct {
   741  				A struct {
   742  					A int64 `json:"a,omitempty"`
   743  				}
   744  				B struct {
   745  					B int64 `json:"b,omitempty"`
   746  				}
   747  			}{},
   748  		},
   749  		{
   750  			name: "HeadInt64ZeroMultiFieldsNotRootString",
   751  			data: struct {
   752  				A struct {
   753  					A int64 `json:"a,string"`
   754  				}
   755  				B struct {
   756  					B int64 `json:"b,string"`
   757  				}
   758  			}{},
   759  		},
   760  
   761  		// HeadInt64MultiFieldsNotRoot
   762  		{
   763  			name: "HeadInt64MultiFieldsNotRoot",
   764  			data: struct {
   765  				A struct {
   766  					A int64 `json:"a"`
   767  				}
   768  				B struct {
   769  					B int64 `json:"b"`
   770  				}
   771  			}{A: struct {
   772  				A int64 `json:"a"`
   773  			}{A: -1}, B: struct {
   774  				B int64 `json:"b"`
   775  			}{B: 2}},
   776  		},
   777  		{
   778  			name: "HeadInt64MultiFieldsNotRootOmitEmpty",
   779  			data: struct {
   780  				A struct {
   781  					A int64 `json:"a,omitempty"`
   782  				}
   783  				B struct {
   784  					B int64 `json:"b,omitempty"`
   785  				}
   786  			}{A: struct {
   787  				A int64 `json:"a,omitempty"`
   788  			}{A: -1}, B: struct {
   789  				B int64 `json:"b,omitempty"`
   790  			}{B: 2}},
   791  		},
   792  		{
   793  			name: "HeadInt64MultiFieldsNotRootString",
   794  			data: struct {
   795  				A struct {
   796  					A int64 `json:"a,string"`
   797  				}
   798  				B struct {
   799  					B int64 `json:"b,string"`
   800  				}
   801  			}{A: struct {
   802  				A int64 `json:"a,string"`
   803  			}{A: -1}, B: struct {
   804  				B int64 `json:"b,string"`
   805  			}{B: 2}},
   806  		},
   807  
   808  		// HeadInt64PtrMultiFieldsNotRoot
   809  		{
   810  			name: "HeadInt64PtrMultiFieldsNotRoot",
   811  			data: struct {
   812  				A struct {
   813  					A *int64 `json:"a"`
   814  				}
   815  				B struct {
   816  					B *int64 `json:"b"`
   817  				}
   818  			}{A: struct {
   819  				A *int64 `json:"a"`
   820  			}{A: int64ptr(-1)}, B: struct {
   821  				B *int64 `json:"b"`
   822  			}{B: int64ptr(2)}},
   823  		},
   824  		{
   825  			name: "HeadInt64PtrMultiFieldsNotRootOmitEmpty",
   826  			data: struct {
   827  				A struct {
   828  					A *int64 `json:"a,omitempty"`
   829  				}
   830  				B struct {
   831  					B *int64 `json:"b,omitempty"`
   832  				}
   833  			}{A: struct {
   834  				A *int64 `json:"a,omitempty"`
   835  			}{A: int64ptr(-1)}, B: struct {
   836  				B *int64 `json:"b,omitempty"`
   837  			}{B: int64ptr(2)}},
   838  		},
   839  		{
   840  			name: "HeadInt64PtrMultiFieldsNotRootString",
   841  			data: struct {
   842  				A struct {
   843  					A *int64 `json:"a,string"`
   844  				}
   845  				B struct {
   846  					B *int64 `json:"b,string"`
   847  				}
   848  			}{A: struct {
   849  				A *int64 `json:"a,string"`
   850  			}{A: int64ptr(-1)}, B: struct {
   851  				B *int64 `json:"b,string"`
   852  			}{B: int64ptr(2)}},
   853  		},
   854  
   855  		// HeadInt64PtrNilMultiFieldsNotRoot
   856  		{
   857  			name: "HeadInt64PtrNilMultiFieldsNotRoot",
   858  			data: struct {
   859  				A struct {
   860  					A *int64 `json:"a"`
   861  				}
   862  				B struct {
   863  					B *int64 `json:"b"`
   864  				}
   865  			}{A: struct {
   866  				A *int64 `json:"a"`
   867  			}{A: nil}, B: struct {
   868  				B *int64 `json:"b"`
   869  			}{B: nil}},
   870  		},
   871  		{
   872  			name: "HeadInt64PtrNilMultiFieldsNotRootOmitEmpty",
   873  			data: struct {
   874  				A struct {
   875  					A *int64 `json:"a,omitempty"`
   876  				}
   877  				B struct {
   878  					B *int64 `json:"b,omitempty"`
   879  				}
   880  			}{A: struct {
   881  				A *int64 `json:"a,omitempty"`
   882  			}{A: nil}, B: struct {
   883  				B *int64 `json:"b,omitempty"`
   884  			}{B: nil}},
   885  		},
   886  		{
   887  			name: "HeadInt64PtrNilMultiFieldsNotRootString",
   888  			data: struct {
   889  				A struct {
   890  					A *int64 `json:"a,string"`
   891  				}
   892  				B struct {
   893  					B *int64 `json:"b,string"`
   894  				}
   895  			}{A: struct {
   896  				A *int64 `json:"a,string"`
   897  			}{A: nil}, B: struct {
   898  				B *int64 `json:"b,string"`
   899  			}{B: nil}},
   900  		},
   901  
   902  		// PtrHeadInt64ZeroMultiFieldsNotRoot
   903  		{
   904  			name: "PtrHeadInt64ZeroMultiFieldsNotRoot",
   905  			data: &struct {
   906  				A struct {
   907  					A int64 `json:"a"`
   908  				}
   909  				B struct {
   910  					B int64 `json:"b"`
   911  				}
   912  			}{},
   913  		},
   914  		{
   915  			name: "PtrHeadInt64ZeroMultiFieldsNotRootOmitEmpty",
   916  			data: &struct {
   917  				A struct {
   918  					A int64 `json:"a,omitempty"`
   919  				}
   920  				B struct {
   921  					B int64 `json:"b,omitempty"`
   922  				}
   923  			}{},
   924  		},
   925  		{
   926  			name: "PtrHeadInt64ZeroMultiFieldsNotRootString",
   927  			data: &struct {
   928  				A struct {
   929  					A int64 `json:"a,string"`
   930  				}
   931  				B struct {
   932  					B int64 `json:"b,string"`
   933  				}
   934  			}{},
   935  		},
   936  
   937  		// PtrHeadInt64MultiFieldsNotRoot
   938  		{
   939  			name: "PtrHeadInt64MultiFieldsNotRoot",
   940  			data: &struct {
   941  				A struct {
   942  					A int64 `json:"a"`
   943  				}
   944  				B struct {
   945  					B int64 `json:"b"`
   946  				}
   947  			}{A: struct {
   948  				A int64 `json:"a"`
   949  			}{A: -1}, B: struct {
   950  				B int64 `json:"b"`
   951  			}{B: 2}},
   952  		},
   953  		{
   954  			name: "PtrHeadInt64MultiFieldsNotRootOmitEmpty",
   955  			data: &struct {
   956  				A struct {
   957  					A int64 `json:"a,omitempty"`
   958  				}
   959  				B struct {
   960  					B int64 `json:"b,omitempty"`
   961  				}
   962  			}{A: struct {
   963  				A int64 `json:"a,omitempty"`
   964  			}{A: -1}, B: struct {
   965  				B int64 `json:"b,omitempty"`
   966  			}{B: 2}},
   967  		},
   968  		{
   969  			name: "PtrHeadInt64MultiFieldsNotRootString",
   970  			data: &struct {
   971  				A struct {
   972  					A int64 `json:"a,string"`
   973  				}
   974  				B struct {
   975  					B int64 `json:"b,string"`
   976  				}
   977  			}{A: struct {
   978  				A int64 `json:"a,string"`
   979  			}{A: -1}, B: struct {
   980  				B int64 `json:"b,string"`
   981  			}{B: 2}},
   982  		},
   983  
   984  		// PtrHeadInt64PtrMultiFieldsNotRoot
   985  		{
   986  			name: "PtrHeadInt64PtrMultiFieldsNotRoot",
   987  			data: &struct {
   988  				A *struct {
   989  					A *int64 `json:"a"`
   990  				}
   991  				B *struct {
   992  					B *int64 `json:"b"`
   993  				}
   994  			}{A: &(struct {
   995  				A *int64 `json:"a"`
   996  			}{A: int64ptr(-1)}), B: &(struct {
   997  				B *int64 `json:"b"`
   998  			}{B: int64ptr(2)})},
   999  		},
  1000  		{
  1001  			name: "PtrHeadInt64PtrMultiFieldsNotRootOmitEmpty",
  1002  			data: &struct {
  1003  				A *struct {
  1004  					A *int64 `json:"a,omitempty"`
  1005  				}
  1006  				B *struct {
  1007  					B *int64 `json:"b,omitempty"`
  1008  				}
  1009  			}{A: &(struct {
  1010  				A *int64 `json:"a,omitempty"`
  1011  			}{A: int64ptr(-1)}), B: &(struct {
  1012  				B *int64 `json:"b,omitempty"`
  1013  			}{B: int64ptr(2)})},
  1014  		},
  1015  		{
  1016  			name: "PtrHeadInt64PtrMultiFieldsNotRootString",
  1017  			data: &struct {
  1018  				A *struct {
  1019  					A *int64 `json:"a,string"`
  1020  				}
  1021  				B *struct {
  1022  					B *int64 `json:"b,string"`
  1023  				}
  1024  			}{A: &(struct {
  1025  				A *int64 `json:"a,string"`
  1026  			}{A: int64ptr(-1)}), B: &(struct {
  1027  				B *int64 `json:"b,string"`
  1028  			}{B: int64ptr(2)})},
  1029  		},
  1030  
  1031  		// PtrHeadInt64PtrNilMultiFieldsNotRoot
  1032  		{
  1033  			name: "PtrHeadInt64PtrNilMultiFieldsNotRoot",
  1034  			data: &struct {
  1035  				A *struct {
  1036  					A *int64 `json:"a"`
  1037  				}
  1038  				B *struct {
  1039  					B *int64 `json:"b"`
  1040  				}
  1041  			}{A: nil, B: nil},
  1042  		},
  1043  		{
  1044  			name: "PtrHeadInt64PtrNilMultiFieldsNotRootOmitEmpty",
  1045  			data: &struct {
  1046  				A *struct {
  1047  					A *int64 `json:"a,omitempty"`
  1048  				} `json:",omitempty"`
  1049  				B *struct {
  1050  					B *int64 `json:"b,omitempty"`
  1051  				} `json:",omitempty"`
  1052  			}{A: nil, B: nil},
  1053  		},
  1054  		{
  1055  			name: "PtrHeadInt64PtrNilMultiFieldsNotRootString",
  1056  			data: &struct {
  1057  				A *struct {
  1058  					A *int64 `json:"a,string"`
  1059  				} `json:",string"`
  1060  				B *struct {
  1061  					B *int64 `json:"b,string"`
  1062  				} `json:",string"`
  1063  			}{A: nil, B: nil},
  1064  		},
  1065  
  1066  		// PtrHeadInt64NilMultiFieldsNotRoot
  1067  		{
  1068  			name: "PtrHeadInt64NilMultiFieldsNotRoot",
  1069  			data: (*struct {
  1070  				A *struct {
  1071  					A *int64 `json:"a"`
  1072  				}
  1073  				B *struct {
  1074  					B *int64 `json:"b"`
  1075  				}
  1076  			})(nil),
  1077  		},
  1078  		{
  1079  			name: "PtrHeadInt64NilMultiFieldsNotRootOmitEmpty",
  1080  			data: (*struct {
  1081  				A *struct {
  1082  					A *int64 `json:"a,omitempty"`
  1083  				}
  1084  				B *struct {
  1085  					B *int64 `json:"b,omitempty"`
  1086  				}
  1087  			})(nil),
  1088  		},
  1089  		{
  1090  			name: "PtrHeadInt64NilMultiFieldsNotRootString",
  1091  			data: (*struct {
  1092  				A *struct {
  1093  					A *int64 `json:"a,string"`
  1094  				}
  1095  				B *struct {
  1096  					B *int64 `json:"b,string"`
  1097  				}
  1098  			})(nil),
  1099  		},
  1100  
  1101  		// PtrHeadInt64DoubleMultiFieldsNotRoot
  1102  		{
  1103  			name: "PtrHeadInt64DoubleMultiFieldsNotRoot",
  1104  			data: &struct {
  1105  				A *struct {
  1106  					A int64 `json:"a"`
  1107  					B int64 `json:"b"`
  1108  				}
  1109  				B *struct {
  1110  					A int64 `json:"a"`
  1111  					B int64 `json:"b"`
  1112  				}
  1113  			}{A: &(struct {
  1114  				A int64 `json:"a"`
  1115  				B int64 `json:"b"`
  1116  			}{A: -1, B: 2}), B: &(struct {
  1117  				A int64 `json:"a"`
  1118  				B int64 `json:"b"`
  1119  			}{A: 3, B: 4})},
  1120  		},
  1121  		{
  1122  			name: "PtrHeadInt64DoubleMultiFieldsNotRootOmitEmpty",
  1123  			data: &struct {
  1124  				A *struct {
  1125  					A int64 `json:"a,omitempty"`
  1126  					B int64 `json:"b,omitempty"`
  1127  				}
  1128  				B *struct {
  1129  					A int64 `json:"a,omitempty"`
  1130  					B int64 `json:"b,omitempty"`
  1131  				}
  1132  			}{A: &(struct {
  1133  				A int64 `json:"a,omitempty"`
  1134  				B int64 `json:"b,omitempty"`
  1135  			}{A: -1, B: 2}), B: &(struct {
  1136  				A int64 `json:"a,omitempty"`
  1137  				B int64 `json:"b,omitempty"`
  1138  			}{A: 3, B: 4})},
  1139  		},
  1140  		{
  1141  			name: "PtrHeadInt64DoubleMultiFieldsNotRootString",
  1142  			data: &struct {
  1143  				A *struct {
  1144  					A int64 `json:"a,string"`
  1145  					B int64 `json:"b,string"`
  1146  				}
  1147  				B *struct {
  1148  					A int64 `json:"a,string"`
  1149  					B int64 `json:"b,string"`
  1150  				}
  1151  			}{A: &(struct {
  1152  				A int64 `json:"a,string"`
  1153  				B int64 `json:"b,string"`
  1154  			}{A: -1, B: 2}), B: &(struct {
  1155  				A int64 `json:"a,string"`
  1156  				B int64 `json:"b,string"`
  1157  			}{A: 3, B: 4})},
  1158  		},
  1159  
  1160  		// PtrHeadInt64NilDoubleMultiFieldsNotRoot
  1161  		{
  1162  			name: "PtrHeadInt64NilDoubleMultiFieldsNotRoot",
  1163  			data: &struct {
  1164  				A *struct {
  1165  					A int64 `json:"a"`
  1166  					B int64 `json:"b"`
  1167  				}
  1168  				B *struct {
  1169  					A int64 `json:"a"`
  1170  					B int64 `json:"b"`
  1171  				}
  1172  			}{A: nil, B: nil},
  1173  		},
  1174  		{
  1175  			name: "PtrHeadInt64NilDoubleMultiFieldsNotRootOmitEmpty",
  1176  			data: &struct {
  1177  				A *struct {
  1178  					A int64 `json:"a,omitempty"`
  1179  					B int64 `json:"b,omitempty"`
  1180  				} `json:",omitempty"`
  1181  				B *struct {
  1182  					A int64 `json:"a,omitempty"`
  1183  					B int64 `json:"b,omitempty"`
  1184  				} `json:",omitempty"`
  1185  			}{A: nil, B: nil},
  1186  		},
  1187  		{
  1188  			name: "PtrHeadInt64NilDoubleMultiFieldsNotRootString",
  1189  			data: &struct {
  1190  				A *struct {
  1191  					A int64 `json:"a,string"`
  1192  					B int64 `json:"b,string"`
  1193  				}
  1194  				B *struct {
  1195  					A int64 `json:"a,string"`
  1196  					B int64 `json:"b,string"`
  1197  				}
  1198  			}{A: nil, B: nil},
  1199  		},
  1200  
  1201  		// PtrHeadInt64NilDoubleMultiFieldsNotRoot
  1202  		{
  1203  			name: "PtrHeadInt64NilDoubleMultiFieldsNotRoot",
  1204  			data: (*struct {
  1205  				A *struct {
  1206  					A int64 `json:"a"`
  1207  					B int64 `json:"b"`
  1208  				}
  1209  				B *struct {
  1210  					A int64 `json:"a"`
  1211  					B int64 `json:"b"`
  1212  				}
  1213  			})(nil),
  1214  		},
  1215  		{
  1216  			name: "PtrHeadInt64NilDoubleMultiFieldsNotRootOmitEmpty",
  1217  			data: (*struct {
  1218  				A *struct {
  1219  					A int64 `json:"a,omitempty"`
  1220  					B int64 `json:"b,omitempty"`
  1221  				}
  1222  				B *struct {
  1223  					A int64 `json:"a,omitempty"`
  1224  					B int64 `json:"b,omitempty"`
  1225  				}
  1226  			})(nil),
  1227  		},
  1228  		{
  1229  			name: "PtrHeadInt64NilDoubleMultiFieldsNotRootString",
  1230  			data: (*struct {
  1231  				A *struct {
  1232  					A int64 `json:"a,string"`
  1233  					B int64 `json:"b,string"`
  1234  				}
  1235  				B *struct {
  1236  					A int64 `json:"a,string"`
  1237  					B int64 `json:"b,string"`
  1238  				}
  1239  			})(nil),
  1240  		},
  1241  
  1242  		// PtrHeadInt64PtrDoubleMultiFieldsNotRoot
  1243  		{
  1244  			name: "PtrHeadInt64PtrDoubleMultiFieldsNotRoot",
  1245  			data: &struct {
  1246  				A *struct {
  1247  					A *int64 `json:"a"`
  1248  					B *int64 `json:"b"`
  1249  				}
  1250  				B *struct {
  1251  					A *int64 `json:"a"`
  1252  					B *int64 `json:"b"`
  1253  				}
  1254  			}{A: &(struct {
  1255  				A *int64 `json:"a"`
  1256  				B *int64 `json:"b"`
  1257  			}{A: int64ptr(-1), B: int64ptr(2)}), B: &(struct {
  1258  				A *int64 `json:"a"`
  1259  				B *int64 `json:"b"`
  1260  			}{A: int64ptr(3), B: int64ptr(4)})},
  1261  		},
  1262  		{
  1263  			name: "PtrHeadInt64PtrDoubleMultiFieldsNotRootOmitEmpty",
  1264  			data: &struct {
  1265  				A *struct {
  1266  					A *int64 `json:"a,omitempty"`
  1267  					B *int64 `json:"b,omitempty"`
  1268  				}
  1269  				B *struct {
  1270  					A *int64 `json:"a,omitempty"`
  1271  					B *int64 `json:"b,omitempty"`
  1272  				}
  1273  			}{A: &(struct {
  1274  				A *int64 `json:"a,omitempty"`
  1275  				B *int64 `json:"b,omitempty"`
  1276  			}{A: int64ptr(-1), B: int64ptr(2)}), B: &(struct {
  1277  				A *int64 `json:"a,omitempty"`
  1278  				B *int64 `json:"b,omitempty"`
  1279  			}{A: int64ptr(3), B: int64ptr(4)})},
  1280  		},
  1281  		{
  1282  			name: "PtrHeadInt64PtrDoubleMultiFieldsNotRootString",
  1283  			data: &struct {
  1284  				A *struct {
  1285  					A *int64 `json:"a,string"`
  1286  					B *int64 `json:"b,string"`
  1287  				}
  1288  				B *struct {
  1289  					A *int64 `json:"a,string"`
  1290  					B *int64 `json:"b,string"`
  1291  				}
  1292  			}{A: &(struct {
  1293  				A *int64 `json:"a,string"`
  1294  				B *int64 `json:"b,string"`
  1295  			}{A: int64ptr(-1), B: int64ptr(2)}), B: &(struct {
  1296  				A *int64 `json:"a,string"`
  1297  				B *int64 `json:"b,string"`
  1298  			}{A: int64ptr(3), B: int64ptr(4)})},
  1299  		},
  1300  
  1301  		// PtrHeadInt64PtrNilDoubleMultiFieldsNotRoot
  1302  		{
  1303  			name: "PtrHeadInt64PtrNilDoubleMultiFieldsNotRoot",
  1304  			data: &struct {
  1305  				A *struct {
  1306  					A *int64 `json:"a"`
  1307  					B *int64 `json:"b"`
  1308  				}
  1309  				B *struct {
  1310  					A *int64 `json:"a"`
  1311  					B *int64 `json:"b"`
  1312  				}
  1313  			}{A: nil, B: nil},
  1314  		},
  1315  		{
  1316  			name: "PtrHeadInt64PtrNilDoubleMultiFieldsNotRootOmitEmpty",
  1317  			data: &struct {
  1318  				A *struct {
  1319  					A *int64 `json:"a,omitempty"`
  1320  					B *int64 `json:"b,omitempty"`
  1321  				} `json:",omitempty"`
  1322  				B *struct {
  1323  					A *int64 `json:"a,omitempty"`
  1324  					B *int64 `json:"b,omitempty"`
  1325  				} `json:",omitempty"`
  1326  			}{A: nil, B: nil},
  1327  		},
  1328  		{
  1329  			name: "PtrHeadInt64PtrNilDoubleMultiFieldsNotRootString",
  1330  			data: &struct {
  1331  				A *struct {
  1332  					A *int64 `json:"a,string"`
  1333  					B *int64 `json:"b,string"`
  1334  				}
  1335  				B *struct {
  1336  					A *int64 `json:"a,string"`
  1337  					B *int64 `json:"b,string"`
  1338  				}
  1339  			}{A: nil, B: nil},
  1340  		},
  1341  
  1342  		// PtrHeadInt64PtrNilDoubleMultiFieldsNotRoot
  1343  		{
  1344  			name: "PtrHeadInt64PtrNilDoubleMultiFieldsNotRoot",
  1345  			data: (*struct {
  1346  				A *struct {
  1347  					A *int64 `json:"a"`
  1348  					B *int64 `json:"b"`
  1349  				}
  1350  				B *struct {
  1351  					A *int64 `json:"a"`
  1352  					B *int64 `json:"b"`
  1353  				}
  1354  			})(nil),
  1355  		},
  1356  		{
  1357  			name: "PtrHeadInt64PtrNilDoubleMultiFieldsNotRootOmitEmpty",
  1358  			data: (*struct {
  1359  				A *struct {
  1360  					A *int64 `json:"a,omitempty"`
  1361  					B *int64 `json:"b,omitempty"`
  1362  				}
  1363  				B *struct {
  1364  					A *int64 `json:"a,omitempty"`
  1365  					B *int64 `json:"b,omitempty"`
  1366  				}
  1367  			})(nil),
  1368  		},
  1369  		{
  1370  			name: "PtrHeadInt64PtrNilDoubleMultiFieldsNotRootString",
  1371  			data: (*struct {
  1372  				A *struct {
  1373  					A *int64 `json:"a,string"`
  1374  					B *int64 `json:"b,string"`
  1375  				}
  1376  				B *struct {
  1377  					A *int64 `json:"a,string"`
  1378  					B *int64 `json:"b,string"`
  1379  				}
  1380  			})(nil),
  1381  		},
  1382  
  1383  		// AnonymousHeadInt64
  1384  		{
  1385  			name: "AnonymousHeadInt64",
  1386  			data: struct {
  1387  				structInt64
  1388  				B int64 `json:"b"`
  1389  			}{
  1390  				structInt64: structInt64{A: -1},
  1391  				B:           2,
  1392  			},
  1393  		},
  1394  		{
  1395  			name: "AnonymousHeadInt64OmitEmpty",
  1396  			data: struct {
  1397  				structInt64OmitEmpty
  1398  				B int64 `json:"b,omitempty"`
  1399  			}{
  1400  				structInt64OmitEmpty: structInt64OmitEmpty{A: -1},
  1401  				B:                    2,
  1402  			},
  1403  		},
  1404  		{
  1405  			name: "AnonymousHeadInt64String",
  1406  			data: struct {
  1407  				structInt64String
  1408  				B int64 `json:"b,string"`
  1409  			}{
  1410  				structInt64String: structInt64String{A: -1},
  1411  				B:                 2,
  1412  			},
  1413  		},
  1414  
  1415  		// PtrAnonymousHeadInt64
  1416  		{
  1417  			name: "PtrAnonymousHeadInt64",
  1418  			data: struct {
  1419  				*structInt64
  1420  				B int64 `json:"b"`
  1421  			}{
  1422  				structInt64: &structInt64{A: -1},
  1423  				B:           2,
  1424  			},
  1425  		},
  1426  		{
  1427  			name: "PtrAnonymousHeadInt64OmitEmpty",
  1428  			data: struct {
  1429  				*structInt64OmitEmpty
  1430  				B int64 `json:"b,omitempty"`
  1431  			}{
  1432  				structInt64OmitEmpty: &structInt64OmitEmpty{A: -1},
  1433  				B:                    2,
  1434  			},
  1435  		},
  1436  		{
  1437  			name: "PtrAnonymousHeadInt64String",
  1438  			data: struct {
  1439  				*structInt64String
  1440  				B int64 `json:"b,string"`
  1441  			}{
  1442  				structInt64String: &structInt64String{A: -1},
  1443  				B:                 2,
  1444  			},
  1445  		},
  1446  
  1447  		// NilPtrAnonymousHeadInt64
  1448  		{
  1449  			name: "NilPtrAnonymousHeadInt64",
  1450  			data: struct {
  1451  				*structInt64
  1452  				B int64 `json:"b"`
  1453  			}{
  1454  				structInt64: nil,
  1455  				B:           2,
  1456  			},
  1457  		},
  1458  		{
  1459  			name: "NilPtrAnonymousHeadInt64OmitEmpty",
  1460  			data: struct {
  1461  				*structInt64OmitEmpty
  1462  				B int64 `json:"b,omitempty"`
  1463  			}{
  1464  				structInt64OmitEmpty: nil,
  1465  				B:                    2,
  1466  			},
  1467  		},
  1468  		{
  1469  			name: "NilPtrAnonymousHeadInt64String",
  1470  			data: struct {
  1471  				*structInt64String
  1472  				B int64 `json:"b,string"`
  1473  			}{
  1474  				structInt64String: nil,
  1475  				B:                 2,
  1476  			},
  1477  		},
  1478  
  1479  		// AnonymousHeadInt64Ptr
  1480  		{
  1481  			name: "AnonymousHeadInt64Ptr",
  1482  			data: struct {
  1483  				structInt64Ptr
  1484  				B *int64 `json:"b"`
  1485  			}{
  1486  				structInt64Ptr: structInt64Ptr{A: int64ptr(-1)},
  1487  				B:              int64ptr(2),
  1488  			},
  1489  		},
  1490  		{
  1491  			name: "AnonymousHeadInt64PtrOmitEmpty",
  1492  			data: struct {
  1493  				structInt64PtrOmitEmpty
  1494  				B *int64 `json:"b,omitempty"`
  1495  			}{
  1496  				structInt64PtrOmitEmpty: structInt64PtrOmitEmpty{A: int64ptr(-1)},
  1497  				B:                       int64ptr(2),
  1498  			},
  1499  		},
  1500  		{
  1501  			name: "AnonymousHeadInt64PtrString",
  1502  			data: struct {
  1503  				structInt64PtrString
  1504  				B *int64 `json:"b,string"`
  1505  			}{
  1506  				structInt64PtrString: structInt64PtrString{A: int64ptr(-1)},
  1507  				B:                    int64ptr(2),
  1508  			},
  1509  		},
  1510  
  1511  		// AnonymousHeadInt64PtrNil
  1512  		{
  1513  			name: "AnonymousHeadInt64PtrNil",
  1514  			data: struct {
  1515  				structInt64Ptr
  1516  				B *int64 `json:"b"`
  1517  			}{
  1518  				structInt64Ptr: structInt64Ptr{A: nil},
  1519  				B:              int64ptr(2),
  1520  			},
  1521  		},
  1522  		{
  1523  			name: "AnonymousHeadInt64PtrNilOmitEmpty",
  1524  			data: struct {
  1525  				structInt64PtrOmitEmpty
  1526  				B *int64 `json:"b,omitempty"`
  1527  			}{
  1528  				structInt64PtrOmitEmpty: structInt64PtrOmitEmpty{A: nil},
  1529  				B:                       int64ptr(2),
  1530  			},
  1531  		},
  1532  		{
  1533  			name: "AnonymousHeadInt64PtrNilString",
  1534  			data: struct {
  1535  				structInt64PtrString
  1536  				B *int64 `json:"b,string"`
  1537  			}{
  1538  				structInt64PtrString: structInt64PtrString{A: nil},
  1539  				B:                    int64ptr(2),
  1540  			},
  1541  		},
  1542  
  1543  		// PtrAnonymousHeadInt64Ptr
  1544  		{
  1545  			name: "PtrAnonymousHeadInt64Ptr",
  1546  			data: struct {
  1547  				*structInt64Ptr
  1548  				B *int64 `json:"b"`
  1549  			}{
  1550  				structInt64Ptr: &structInt64Ptr{A: int64ptr(-1)},
  1551  				B:              int64ptr(2),
  1552  			},
  1553  		},
  1554  		{
  1555  			name: "PtrAnonymousHeadInt64PtrOmitEmpty",
  1556  			data: struct {
  1557  				*structInt64PtrOmitEmpty
  1558  				B *int64 `json:"b,omitempty"`
  1559  			}{
  1560  				structInt64PtrOmitEmpty: &structInt64PtrOmitEmpty{A: int64ptr(-1)},
  1561  				B:                       int64ptr(2),
  1562  			},
  1563  		},
  1564  		{
  1565  			name: "PtrAnonymousHeadInt64PtrString",
  1566  			data: struct {
  1567  				*structInt64PtrString
  1568  				B *int64 `json:"b,string"`
  1569  			}{
  1570  				structInt64PtrString: &structInt64PtrString{A: int64ptr(-1)},
  1571  				B:                    int64ptr(2),
  1572  			},
  1573  		},
  1574  
  1575  		// NilPtrAnonymousHeadInt64Ptr
  1576  		{
  1577  			name: "NilPtrAnonymousHeadInt64Ptr",
  1578  			data: struct {
  1579  				*structInt64Ptr
  1580  				B *int64 `json:"b"`
  1581  			}{
  1582  				structInt64Ptr: nil,
  1583  				B:              int64ptr(2),
  1584  			},
  1585  		},
  1586  		{
  1587  			name: "NilPtrAnonymousHeadInt64PtrOmitEmpty",
  1588  			data: struct {
  1589  				*structInt64PtrOmitEmpty
  1590  				B *int64 `json:"b,omitempty"`
  1591  			}{
  1592  				structInt64PtrOmitEmpty: nil,
  1593  				B:                       int64ptr(2),
  1594  			},
  1595  		},
  1596  		{
  1597  			name: "NilPtrAnonymousHeadInt64PtrString",
  1598  			data: struct {
  1599  				*structInt64PtrString
  1600  				B *int64 `json:"b,string"`
  1601  			}{
  1602  				structInt64PtrString: nil,
  1603  				B:                    int64ptr(2),
  1604  			},
  1605  		},
  1606  
  1607  		// AnonymousHeadInt64Only
  1608  		{
  1609  			name: "AnonymousHeadInt64Only",
  1610  			data: struct {
  1611  				structInt64
  1612  			}{
  1613  				structInt64: structInt64{A: -1},
  1614  			},
  1615  		},
  1616  		{
  1617  			name: "AnonymousHeadInt64OnlyOmitEmpty",
  1618  			data: struct {
  1619  				structInt64OmitEmpty
  1620  			}{
  1621  				structInt64OmitEmpty: structInt64OmitEmpty{A: -1},
  1622  			},
  1623  		},
  1624  		{
  1625  			name: "AnonymousHeadInt64OnlyString",
  1626  			data: struct {
  1627  				structInt64String
  1628  			}{
  1629  				structInt64String: structInt64String{A: -1},
  1630  			},
  1631  		},
  1632  
  1633  		// PtrAnonymousHeadInt64Only
  1634  		{
  1635  			name: "PtrAnonymousHeadInt64Only",
  1636  			data: struct {
  1637  				*structInt64
  1638  			}{
  1639  				structInt64: &structInt64{A: -1},
  1640  			},
  1641  		},
  1642  		{
  1643  			name: "PtrAnonymousHeadInt64OnlyOmitEmpty",
  1644  			data: struct {
  1645  				*structInt64OmitEmpty
  1646  			}{
  1647  				structInt64OmitEmpty: &structInt64OmitEmpty{A: -1},
  1648  			},
  1649  		},
  1650  		{
  1651  			name: "PtrAnonymousHeadInt64OnlyString",
  1652  			data: struct {
  1653  				*structInt64String
  1654  			}{
  1655  				structInt64String: &structInt64String{A: -1},
  1656  			},
  1657  		},
  1658  
  1659  		// NilPtrAnonymousHeadInt64Only
  1660  		{
  1661  			name: "NilPtrAnonymousHeadInt64Only",
  1662  			data: struct {
  1663  				*structInt64
  1664  			}{
  1665  				structInt64: nil,
  1666  			},
  1667  		},
  1668  		{
  1669  			name: "NilPtrAnonymousHeadInt64OnlyOmitEmpty",
  1670  			data: struct {
  1671  				*structInt64OmitEmpty
  1672  			}{
  1673  				structInt64OmitEmpty: nil,
  1674  			},
  1675  		},
  1676  		{
  1677  			name: "NilPtrAnonymousHeadInt64OnlyString",
  1678  			data: struct {
  1679  				*structInt64String
  1680  			}{
  1681  				structInt64String: nil,
  1682  			},
  1683  		},
  1684  
  1685  		// AnonymousHeadInt64PtrOnly
  1686  		{
  1687  			name: "AnonymousHeadInt64PtrOnly",
  1688  			data: struct {
  1689  				structInt64Ptr
  1690  			}{
  1691  				structInt64Ptr: structInt64Ptr{A: int64ptr(-1)},
  1692  			},
  1693  		},
  1694  		{
  1695  			name: "AnonymousHeadInt64PtrOnlyOmitEmpty",
  1696  			data: struct {
  1697  				structInt64PtrOmitEmpty
  1698  			}{
  1699  				structInt64PtrOmitEmpty: structInt64PtrOmitEmpty{A: int64ptr(-1)},
  1700  			},
  1701  		},
  1702  		{
  1703  			name: "AnonymousHeadInt64PtrOnlyString",
  1704  			data: struct {
  1705  				structInt64PtrString
  1706  			}{
  1707  				structInt64PtrString: structInt64PtrString{A: int64ptr(-1)},
  1708  			},
  1709  		},
  1710  
  1711  		// AnonymousHeadInt64PtrNilOnly
  1712  		{
  1713  			name: "AnonymousHeadInt64PtrNilOnly",
  1714  			data: struct {
  1715  				structInt64Ptr
  1716  			}{
  1717  				structInt64Ptr: structInt64Ptr{A: nil},
  1718  			},
  1719  		},
  1720  		{
  1721  			name: "AnonymousHeadInt64PtrNilOnlyOmitEmpty",
  1722  			data: struct {
  1723  				structInt64PtrOmitEmpty
  1724  			}{
  1725  				structInt64PtrOmitEmpty: structInt64PtrOmitEmpty{A: nil},
  1726  			},
  1727  		},
  1728  		{
  1729  			name: "AnonymousHeadInt64PtrNilOnlyString",
  1730  			data: struct {
  1731  				structInt64PtrString
  1732  			}{
  1733  				structInt64PtrString: structInt64PtrString{A: nil},
  1734  			},
  1735  		},
  1736  
  1737  		// PtrAnonymousHeadInt64PtrOnly
  1738  		{
  1739  			name: "PtrAnonymousHeadInt64PtrOnly",
  1740  			data: struct {
  1741  				*structInt64Ptr
  1742  			}{
  1743  				structInt64Ptr: &structInt64Ptr{A: int64ptr(-1)},
  1744  			},
  1745  		},
  1746  		{
  1747  			name: "PtrAnonymousHeadInt64PtrOnlyOmitEmpty",
  1748  			data: struct {
  1749  				*structInt64PtrOmitEmpty
  1750  			}{
  1751  				structInt64PtrOmitEmpty: &structInt64PtrOmitEmpty{A: int64ptr(-1)},
  1752  			},
  1753  		},
  1754  		{
  1755  			name: "PtrAnonymousHeadInt64PtrOnlyString",
  1756  			data: struct {
  1757  				*structInt64PtrString
  1758  			}{
  1759  				structInt64PtrString: &structInt64PtrString{A: int64ptr(-1)},
  1760  			},
  1761  		},
  1762  
  1763  		// NilPtrAnonymousHeadInt64PtrOnly
  1764  		{
  1765  			name: "NilPtrAnonymousHeadInt64PtrOnly",
  1766  			data: struct {
  1767  				*structInt64Ptr
  1768  			}{
  1769  				structInt64Ptr: nil,
  1770  			},
  1771  		},
  1772  		{
  1773  			name: "NilPtrAnonymousHeadInt64PtrOnlyOmitEmpty",
  1774  			data: struct {
  1775  				*structInt64PtrOmitEmpty
  1776  			}{
  1777  				structInt64PtrOmitEmpty: nil,
  1778  			},
  1779  		},
  1780  		{
  1781  			name: "NilPtrAnonymousHeadInt64PtrOnlyString",
  1782  			data: struct {
  1783  				*structInt64PtrString
  1784  			}{
  1785  				structInt64PtrString: nil,
  1786  			},
  1787  		},
  1788  	}
  1789  	for _, test := range tests {
  1790  		for _, indent := range []bool{true, false} {
  1791  			for _, htmlEscape := range []bool{true, false} {
  1792  				t.Run(fmt.Sprintf("%s_indent_%t_escape_%t", test.name, indent, htmlEscape), func(t *testing.T) {
  1793  					var buf bytes.Buffer
  1794  					enc := json.NewEncoder(&buf)
  1795  					enc.SetEscapeHTML(htmlEscape)
  1796  					if indent {
  1797  						enc.SetIndent("", "  ")
  1798  					}
  1799  					if err := enc.Encode(test.data); err != nil {
  1800  						t.Fatalf("%s(htmlEscape:%T): %+v: %s", test.name, htmlEscape, test.data, err)
  1801  					}
  1802  					stdresult := encodeByEncodingJSON(test.data, indent, htmlEscape)
  1803  					if buf.String() != stdresult {
  1804  						t.Errorf("%s(htmlEscape:%T): doesn't compatible with encoding/json. expected %q but got %q", test.name, htmlEscape, stdresult, buf.String())
  1805  					}
  1806  				})
  1807  			}
  1808  		}
  1809  	}
  1810  }