| 1 |
package test |
| 2 |
|
| 3 |
import "time" |
| 4 |
|
| 5 |
func init() { |
| 6 |
structFields1To11() |
| 7 |
testCases = append(testCases, |
| 8 |
(*struct1Alias)(nil), |
| 9 |
(*struct { |
| 10 |
F [4]*string |
| 11 |
})(nil), |
| 12 |
(*struct { |
| 13 |
F [4]string |
| 14 |
})(nil), |
| 15 |
(*struct { |
| 16 |
F1 [4]stringAlias |
| 17 |
F2 arrayAlis |
| 18 |
})(nil), |
| 19 |
(*struct { |
| 20 |
F1 [4]string |
| 21 |
F2 [4]string |
| 22 |
F3 [4]string |
| 23 |
})(nil), |
| 24 |
(*struct { |
| 25 |
F [4]struct { |
| 26 |
F1 string |
| 27 |
F2 string |
| 28 |
F3 string |
| 29 |
} |
| 30 |
})(nil), |
| 31 |
(*struct{})(nil), |
| 32 |
(*structEmpty)(nil), |
| 33 |
(*struct { |
| 34 |
Byte1 byte |
| 35 |
Byte2 byte |
| 36 |
Bool1 bool |
| 37 |
Bool2 bool |
| 38 |
Int8 int8 |
| 39 |
Int16 int16 |
| 40 |
Int32 int32 |
| 41 |
Int64 int64 |
| 42 |
Uint8 uint8 |
| 43 |
Uint16 uint16 |
| 44 |
Uint32 uint32 |
| 45 |
Uint64 uint64 |
| 46 |
Float32 float32 |
| 47 |
Float64 float64 |
| 48 |
String1 string |
| 49 |
String2 string |
| 50 |
})(nil), |
| 51 |
(*struct { |
| 52 |
F float64 |
| 53 |
})(nil), |
| 54 |
(*struct { |
| 55 |
F float64Alias |
| 56 |
})(nil), |
| 57 |
(*struct { |
| 58 |
F1 float64 |
| 59 |
F2 float64 |
| 60 |
F3 float64 |
| 61 |
})(nil), |
| 62 |
(*struct { |
| 63 |
F1 float64Alias |
| 64 |
F2 float64Alias |
| 65 |
F3 float64Alias |
| 66 |
})(nil), |
| 67 |
(*struct { |
| 68 |
F int32 |
| 69 |
})(nil), |
| 70 |
(*struct { |
| 71 |
F int32Alias |
| 72 |
})(nil), |
| 73 |
(*struct { |
| 74 |
F1 int32 |
| 75 |
F2 int32 |
| 76 |
F3 int32 |
| 77 |
})(nil), |
| 78 |
(*struct { |
| 79 |
F1 int32Alias |
| 80 |
F2 int32Alias |
| 81 |
F3 int32Alias |
| 82 |
})(nil), |
| 83 |
(*struct { |
| 84 |
F int64 |
| 85 |
})(nil), |
| 86 |
(*struct { |
| 87 |
F map[int32]*string |
| 88 |
})(nil), |
| 89 |
(*struct { |
| 90 |
F map[int32]string |
| 91 |
})(nil), |
| 92 |
(*struct { |
| 93 |
F map[int32]struct { |
| 94 |
F1 string |
| 95 |
F2 string |
| 96 |
F3 string |
| 97 |
} |
| 98 |
})(nil), |
| 99 |
(*struct { |
| 100 |
F map[string]*string |
| 101 |
})(nil), |
| 102 |
(*struct { |
| 103 |
F map[string]string |
| 104 |
})(nil), |
| 105 |
(*struct { |
| 106 |
F map[string]struct { |
| 107 |
F1 string |
| 108 |
F2 string |
| 109 |
F3 string |
| 110 |
} |
| 111 |
})(nil), |
| 112 |
(*struct { |
| 113 |
F *float64 |
| 114 |
})(nil), |
| 115 |
(*struct { |
| 116 |
F1 *float64Alias |
| 117 |
F2 ptrFloat64Alias |
| 118 |
F3 *ptrFloat64Alias |
| 119 |
})(nil), |
| 120 |
(*struct { |
| 121 |
F *int32 |
| 122 |
})(nil), |
| 123 |
(*struct { |
| 124 |
F1 *int32Alias |
| 125 |
F2 ptrInt32Alias |
| 126 |
F3 *ptrInt32Alias |
| 127 |
})(nil), |
| 128 |
(*struct { |
| 129 |
F **struct{} |
| 130 |
})(nil), |
| 131 |
(*struct { |
| 132 |
F **struct { |
| 133 |
F1 string |
| 134 |
F2 string |
| 135 |
F3 string |
| 136 |
} |
| 137 |
})(nil), |
| 138 |
(*struct { |
| 139 |
F *string |
| 140 |
})(nil), |
| 141 |
(*struct { |
| 142 |
F1 *stringAlias |
| 143 |
F2 ptrStringAlias |
| 144 |
F3 *ptrStringAlias |
| 145 |
})(nil), |
| 146 |
(*struct { |
| 147 |
F *struct{} |
| 148 |
})(nil), |
| 149 |
(*struct { |
| 150 |
F *struct { |
| 151 |
F1 string |
| 152 |
F2 string |
| 153 |
F3 string |
| 154 |
} |
| 155 |
})(nil), |
| 156 |
(*struct { |
| 157 |
F1 *float64 |
| 158 |
F2 *float64 |
| 159 |
F3 *float64 |
| 160 |
})(nil), |
| 161 |
(*struct { |
| 162 |
F1 *int32 |
| 163 |
F2 *int32 |
| 164 |
F3 *int32 |
| 165 |
})(nil), |
| 166 |
(*struct { |
| 167 |
F1 *string |
| 168 |
F2 *string |
| 169 |
F3 *string |
| 170 |
})(nil), |
| 171 |
(*struct { |
| 172 |
F []*string |
| 173 |
})(nil), |
| 174 |
(*struct { |
| 175 |
F []string |
| 176 |
})(nil), |
| 177 |
(*struct { |
| 178 |
F1 []stringAlias |
| 179 |
F2 stringAlias |
| 180 |
})(nil), |
| 181 |
(*struct { |
| 182 |
F1 []string |
| 183 |
F2 []string |
| 184 |
F3 []string |
| 185 |
})(nil), |
| 186 |
(*struct { |
| 187 |
F []struct { |
| 188 |
F1 string |
| 189 |
F2 string |
| 190 |
F3 string |
| 191 |
} |
| 192 |
})(nil), |
| 193 |
(*struct { |
| 194 |
F string |
| 195 |
})(nil), |
| 196 |
(*struct { |
| 197 |
F stringAlias |
| 198 |
})(nil), |
| 199 |
(*struct { |
| 200 |
F1 string |
| 201 |
F2 string |
| 202 |
F3 string |
| 203 |
})(nil), |
| 204 |
(*struct { |
| 205 |
F1 stringAlias |
| 206 |
F2 stringAlias |
| 207 |
F3 stringAlias |
| 208 |
})(nil), |
| 209 |
(*struct { |
| 210 |
F1 struct{} |
| 211 |
F2 struct{} |
| 212 |
F3 struct{} |
| 213 |
})(nil), |
| 214 |
(*struct { |
| 215 |
F struct{} |
| 216 |
})(nil), |
| 217 |
(*struct { |
| 218 |
F structEmpty |
| 219 |
})(nil), |
| 220 |
(*struct { |
| 221 |
F struct { |
| 222 |
F1 float32 |
| 223 |
F2 float32 |
| 224 |
F3 float32 |
| 225 |
} |
| 226 |
})(nil), |
| 227 |
(*struct { |
| 228 |
F struct { |
| 229 |
F float32 |
| 230 |
} |
| 231 |
})(nil), |
| 232 |
(*struct { |
| 233 |
F struct2 |
| 234 |
})(nil), |
| 235 |
(*struct { |
| 236 |
F struct { |
| 237 |
F1 int32 |
| 238 |
F2 int32 |
| 239 |
F3 int32 |
| 240 |
} |
| 241 |
})(nil), |
| 242 |
(*struct { |
| 243 |
F struct { |
| 244 |
F1 string |
| 245 |
F2 string |
| 246 |
F3 string |
| 247 |
} |
| 248 |
})(nil), |
| 249 |
(*struct { |
| 250 |
F struct3 |
| 251 |
})(nil), |
| 252 |
(*struct { |
| 253 |
TF1 struct { |
| 254 |
F2 int |
| 255 |
F1 *withTime |
| 256 |
} |
| 257 |
})(nil), |
| 258 |
(*DeeplyNested)(nil), |
| 259 |
) |
| 260 |
} |
| 261 |
|
| 262 |
func structFields1To11() { |
| 263 |
testCases = append(testCases, |
| 264 |
(*struct { |
| 265 |
Field1 string |
| 266 |
})(nil), |
| 267 |
(*struct { |
| 268 |
Field1 string |
| 269 |
Field2 string |
| 270 |
})(nil), |
| 271 |
(*struct { |
| 272 |
Field1 string |
| 273 |
Field2 string |
| 274 |
Field3 string |
| 275 |
})(nil), |
| 276 |
(*struct { |
| 277 |
Field1 string |
| 278 |
Field2 string |
| 279 |
Field3 string |
| 280 |
Field4 string |
| 281 |
})(nil), |
| 282 |
(*struct { |
| 283 |
Field1 string |
| 284 |
Field2 string |
| 285 |
Field3 string |
| 286 |
Field4 string |
| 287 |
Field5 string |
| 288 |
})(nil), |
| 289 |
(*struct { |
| 290 |
Field1 string |
| 291 |
Field2 string |
| 292 |
Field3 string |
| 293 |
Field4 string |
| 294 |
Field5 string |
| 295 |
Field6 string |
| 296 |
})(nil), |
| 297 |
(*struct { |
| 298 |
Field1 string |
| 299 |
Field2 string |
| 300 |
Field3 string |
| 301 |
Field4 string |
| 302 |
Field5 string |
| 303 |
Field6 string |
| 304 |
Field7 string |
| 305 |
})(nil), |
| 306 |
(*struct { |
| 307 |
Field1 string |
| 308 |
Field2 string |
| 309 |
Field3 string |
| 310 |
Field4 string |
| 311 |
Field5 string |
| 312 |
Field6 string |
| 313 |
Field7 string |
| 314 |
Field8 string |
| 315 |
})(nil), |
| 316 |
(*struct { |
| 317 |
Field1 string |
| 318 |
Field2 string |
| 319 |
Field3 string |
| 320 |
Field4 string |
| 321 |
Field5 string |
| 322 |
Field6 string |
| 323 |
Field7 string |
| 324 |
Field8 string |
| 325 |
Field9 string |
| 326 |
})(nil), |
| 327 |
(*struct { |
| 328 |
Field1 string |
| 329 |
Field2 string |
| 330 |
Field3 string |
| 331 |
Field4 string |
| 332 |
Field5 string |
| 333 |
Field6 string |
| 334 |
Field7 string |
| 335 |
Field8 string |
| 336 |
Field9 string |
| 337 |
Field10 string |
| 338 |
})(nil), |
| 339 |
(*struct { |
| 340 |
Field1 string |
| 341 |
Field2 string |
| 342 |
Field3 string |
| 343 |
Field4 string |
| 344 |
Field5 string |
| 345 |
Field6 string |
| 346 |
Field7 string |
| 347 |
Field8 string |
| 348 |
Field9 string |
| 349 |
Field10 string |
| 350 |
Field11 string |
| 351 |
})(nil), |
| 352 |
) |
| 353 |
} |
| 354 |
|
| 355 |
type struct1 struct { |
| 356 |
Byte1 byte |
| 357 |
Byte2 byte |
| 358 |
Bool1 bool |
| 359 |
Bool2 bool |
| 360 |
Int8 int8 |
| 361 |
Int16 int16 |
| 362 |
Int32 int32 |
| 363 |
Uint8 uint8 |
| 364 |
Uint16 uint16 |
| 365 |
Uint32 uint32 |
| 366 |
Float32 float32 |
| 367 |
Float64 float64 |
| 368 |
String1 string |
| 369 |
String2 string |
| 370 |
} |
| 371 |
type struct1Alias struct1 |
| 372 |
|
| 373 |
type struct2 struct { |
| 374 |
F float64 |
| 375 |
} |
| 376 |
type struct3 struct { |
| 377 |
F1 stringAlias |
| 378 |
F2 stringAlias |
| 379 |
F3 stringAlias |
| 380 |
} |
| 381 |
|
| 382 |
type withTime struct { |
| 383 |
time.Time |
| 384 |
} |
| 385 |
|
| 386 |
func (t *withTime) UnmarshalJSON(b []byte) error { |
| 387 |
return nil |
| 388 |
} |
| 389 |
func (t withTime) MarshalJSON() ([]byte, error) { |
| 390 |
return []byte(`"fake"`), nil |
| 391 |
} |
| 392 |
|
| 393 |
type YetYetAnotherObject struct { |
| 394 |
Field string |
| 395 |
} |
| 396 |
type YetAnotherObject struct { |
| 397 |
Field *YetYetAnotherObject |
| 398 |
} |
| 399 |
type AnotherObject struct { |
| 400 |
Field *YetAnotherObject |
| 401 |
} |
| 402 |
type DeeplyNested struct { |
| 403 |
Me *AnotherObject |
| 404 |
} |