struct_test.go 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. package test
  2. import "time"
  3. func init() {
  4. testCases = append(testCases,
  5. (*struct1Alias)(nil),
  6. (*struct {
  7. F [4]*string
  8. })(nil),
  9. (*struct {
  10. F [4]string
  11. })(nil),
  12. (*struct {
  13. F1 [4]stringAlias
  14. F2 arrayAlis
  15. })(nil),
  16. (*struct {
  17. F1 [4]string
  18. F2 [4]string
  19. F3 [4]string
  20. })(nil),
  21. (*struct {
  22. F [4]struct {
  23. F1 string
  24. F2 string
  25. F3 string
  26. }
  27. })(nil),
  28. (*struct{})(nil),
  29. (*structEmpty)(nil),
  30. (*struct {
  31. Byte1 byte
  32. Byte2 byte
  33. Bool1 bool
  34. Bool2 bool
  35. Int8 int8
  36. Int16 int16
  37. Int32 int32
  38. Int64 int64
  39. Uint8 uint8
  40. Uint16 uint16
  41. Uint32 uint32
  42. Uint64 uint64
  43. Float32 float32
  44. Float64 float64
  45. String1 string
  46. String2 string
  47. })(nil),
  48. (*struct {
  49. F float64
  50. })(nil),
  51. (*struct {
  52. F float64Alias
  53. })(nil),
  54. (*struct {
  55. F1 float64
  56. F2 float64
  57. F3 float64
  58. })(nil),
  59. (*struct {
  60. F1 float64Alias
  61. F2 float64Alias
  62. F3 float64Alias
  63. })(nil),
  64. (*struct {
  65. F int32
  66. })(nil),
  67. (*struct {
  68. F int32Alias
  69. })(nil),
  70. (*struct {
  71. F1 int32
  72. F2 int32
  73. F3 int32
  74. })(nil),
  75. (*struct {
  76. F1 int32Alias
  77. F2 int32Alias
  78. F3 int32Alias
  79. })(nil),
  80. (*struct {
  81. F int64
  82. })(nil),
  83. (*struct {
  84. F map[int32]*string
  85. })(nil),
  86. (*struct {
  87. F map[int32]string
  88. })(nil),
  89. (*struct {
  90. F map[int32]struct {
  91. F1 string
  92. F2 string
  93. F3 string
  94. }
  95. })(nil),
  96. (*struct {
  97. F map[string]*string
  98. })(nil),
  99. (*struct {
  100. F map[string]string
  101. })(nil),
  102. (*struct {
  103. F map[string]struct {
  104. F1 string
  105. F2 string
  106. F3 string
  107. }
  108. })(nil),
  109. (*struct {
  110. F *float64
  111. })(nil),
  112. (*struct {
  113. F1 *float64Alias
  114. F2 ptrFloat64Alias
  115. F3 *ptrFloat64Alias
  116. })(nil),
  117. (*struct {
  118. F *int32
  119. })(nil),
  120. (*struct {
  121. F1 *int32Alias
  122. F2 ptrInt32Alias
  123. F3 *ptrInt32Alias
  124. })(nil),
  125. (*struct {
  126. F **struct{}
  127. })(nil),
  128. (*struct {
  129. F **struct {
  130. F1 string
  131. F2 string
  132. F3 string
  133. }
  134. })(nil),
  135. (*struct {
  136. F *string
  137. })(nil),
  138. (*struct {
  139. F1 *stringAlias
  140. F2 ptrStringAlias
  141. F3 *ptrStringAlias
  142. })(nil),
  143. (*struct {
  144. F *struct{}
  145. })(nil),
  146. (*struct {
  147. F *struct {
  148. F1 string
  149. F2 string
  150. F3 string
  151. }
  152. })(nil),
  153. (*struct {
  154. F1 *float64
  155. F2 *float64
  156. F3 *float64
  157. })(nil),
  158. (*struct {
  159. F1 *int32
  160. F2 *int32
  161. F3 *int32
  162. })(nil),
  163. (*struct {
  164. F1 *string
  165. F2 *string
  166. F3 *string
  167. })(nil),
  168. (*struct {
  169. F []*string
  170. })(nil),
  171. (*struct {
  172. F []string
  173. })(nil),
  174. (*struct {
  175. F1 []stringAlias
  176. F2 stringAlias
  177. })(nil),
  178. (*struct {
  179. F1 []string
  180. F2 []string
  181. F3 []string
  182. })(nil),
  183. (*struct {
  184. F []struct {
  185. F1 string
  186. F2 string
  187. F3 string
  188. }
  189. })(nil),
  190. (*struct {
  191. F string
  192. })(nil),
  193. (*struct {
  194. F stringAlias
  195. })(nil),
  196. (*struct {
  197. F1 string
  198. F2 string
  199. F3 string
  200. })(nil),
  201. (*struct {
  202. F1 stringAlias
  203. F2 stringAlias
  204. F3 stringAlias
  205. })(nil),
  206. (*struct {
  207. F1 struct{}
  208. F2 struct{}
  209. F3 struct{}
  210. })(nil),
  211. (*struct {
  212. F struct{}
  213. })(nil),
  214. (*struct {
  215. F structEmpty
  216. })(nil),
  217. (*struct {
  218. F struct {
  219. F1 float32
  220. F2 float32
  221. F3 float32
  222. }
  223. })(nil),
  224. (*struct {
  225. F struct {
  226. F float32
  227. }
  228. })(nil),
  229. (*struct {
  230. F struct2
  231. })(nil),
  232. (*struct {
  233. F struct {
  234. F1 int32
  235. F2 int32
  236. F3 int32
  237. }
  238. })(nil),
  239. (*struct {
  240. F struct {
  241. F1 string
  242. F2 string
  243. F3 string
  244. }
  245. })(nil),
  246. (*struct {
  247. F struct3
  248. })(nil),
  249. (*struct {
  250. TF1 struct {
  251. F1 withTime
  252. F2 *withTime
  253. }
  254. })(nil),
  255. (*DeeplyNested)(nil),
  256. )
  257. }
  258. type struct1 struct {
  259. Byte1 byte
  260. Byte2 byte
  261. Bool1 bool
  262. Bool2 bool
  263. Int8 int8
  264. Int16 int16
  265. Int32 int32
  266. Uint8 uint8
  267. Uint16 uint16
  268. Uint32 uint32
  269. Float32 float32
  270. Float64 float64
  271. String1 string
  272. String2 string
  273. }
  274. type struct1Alias struct1
  275. type struct2 struct {
  276. F float64
  277. }
  278. type struct3 struct {
  279. F1 stringAlias
  280. F2 stringAlias
  281. F3 stringAlias
  282. }
  283. type withTime struct {
  284. time.Time
  285. }
  286. func (t *withTime) UnmarshalJSON(b []byte) error {
  287. return nil
  288. }
  289. func (t withTime) MarshalJSON() ([]byte, error) {
  290. return []byte(`"fake"`), nil
  291. }
  292. type YetYetAnotherObject struct {
  293. Field string
  294. }
  295. type YetAnotherObject struct {
  296. Field *YetYetAnotherObject
  297. }
  298. type AnotherObject struct {
  299. Field *YetAnotherObject
  300. }
  301. type DeeplyNested struct {
  302. Me *AnotherObject
  303. }