struct_embedded_test.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. package test
  2. func init() {
  3. testCases = append(testCases,
  4. (*struct {
  5. EmbeddedFloat64
  6. })(nil),
  7. (*struct {
  8. EmbeddedInt32
  9. })(nil),
  10. (*struct {
  11. F1 float64
  12. StringMarshaler
  13. F2 int32
  14. })(nil),
  15. (*struct {
  16. EmbeddedMapStringString
  17. })(nil),
  18. (*struct {
  19. *EmbeddedFloat64
  20. })(nil),
  21. (*struct {
  22. *EmbeddedInt32
  23. })(nil),
  24. (*struct {
  25. *EmbeddedMapStringString
  26. })(nil),
  27. (*struct {
  28. *EmbeddedSliceString
  29. })(nil),
  30. (*struct {
  31. *EmbeddedString
  32. })(nil),
  33. (*struct {
  34. *EmbeddedStruct
  35. })(nil),
  36. (*struct {
  37. EmbeddedSliceString
  38. })(nil),
  39. (*struct {
  40. EmbeddedString
  41. })(nil),
  42. (*struct {
  43. EmbeddedString `json:"othername"`
  44. })(nil),
  45. (*struct {
  46. EmbeddedStruct
  47. })(nil),
  48. (*struct {
  49. F1 float64
  50. StringTextMarshaler
  51. F2 int32
  52. })(nil),
  53. (*OverlapDifferentLevels)(nil),
  54. (*IgnoreDeeperLevel)(nil),
  55. (*SameLevel1BothTagged)(nil),
  56. (*SameLevel1NoTags)(nil),
  57. (*SameLevel1Tagged)(nil),
  58. (*SameLevel2BothTagged)(nil),
  59. (*SameLevel2NoTags)(nil),
  60. (*SameLevel2Tagged)(nil),
  61. (*EmbeddedPtr)(nil),
  62. (*UnnamedLiteral)(nil),
  63. )
  64. }
  65. type EmbeddedFloat64 float64
  66. type EmbeddedInt32 int32
  67. type EmbeddedMapStringString map[string]string
  68. type EmbeddedSliceString []string
  69. type EmbeddedString string
  70. type EmbeddedStruct struct {
  71. String string
  72. Int int32
  73. Float float64
  74. Struct struct {
  75. X string
  76. }
  77. Slice []string
  78. Map map[string]string
  79. }
  80. type OverlapDifferentLevelsE1 struct {
  81. F1 int32
  82. }
  83. type OverlapDifferentLevelsE2 struct {
  84. F2 string
  85. }
  86. type OverlapDifferentLevels struct {
  87. OverlapDifferentLevelsE1
  88. OverlapDifferentLevelsE2
  89. F1 string
  90. }
  91. type IgnoreDeeperLevelDoubleEmbedded struct {
  92. F1 int32 `json:"F1"`
  93. }
  94. type IgnoreDeeperLevelE1 struct {
  95. IgnoreDeeperLevelDoubleEmbedded
  96. F1 int32
  97. }
  98. type IgnoreDeeperLevelE2 struct {
  99. F1 int32 `json:"F1"`
  100. IgnoreDeeperLevelDoubleEmbedded
  101. }
  102. type IgnoreDeeperLevel struct {
  103. IgnoreDeeperLevelE1
  104. IgnoreDeeperLevelE2
  105. }
  106. type SameLevel1BothTaggedE1 struct {
  107. F1 int32 `json:"F1"`
  108. }
  109. type SameLevel1BothTaggedE2 struct {
  110. F1 int32 `json:"F1"`
  111. }
  112. type SameLevel1BothTagged struct {
  113. SameLevel1BothTaggedE1
  114. SameLevel1BothTaggedE2
  115. }
  116. type SameLevel1NoTagsE1 struct {
  117. F1 int32
  118. }
  119. type SameLevel1NoTagsE2 struct {
  120. F1 int32
  121. }
  122. type SameLevel1NoTags struct {
  123. SameLevel1NoTagsE1
  124. SameLevel1NoTagsE2
  125. }
  126. type SameLevel1TaggedE1 struct {
  127. F1 int32
  128. }
  129. type SameLevel1TaggedE2 struct {
  130. F1 int32 `json:"F1"`
  131. }
  132. type SameLevel1Tagged struct {
  133. SameLevel1TaggedE1
  134. SameLevel1TaggedE2
  135. }
  136. type SameLevel2BothTaggedDE1 struct {
  137. F1 int32 `json:"F1"`
  138. }
  139. type SameLevel2BothTaggedE1 struct {
  140. SameLevel2BothTaggedDE1
  141. }
  142. // DoubleEmbedded2 TEST ONLY
  143. type SameLevel2BothTaggedDE2 struct {
  144. F1 int32 `json:"F1"`
  145. }
  146. // Embedded2 TEST ONLY
  147. type SameLevel2BothTaggedE2 struct {
  148. SameLevel2BothTaggedDE2
  149. }
  150. type SameLevel2BothTagged struct {
  151. SameLevel2BothTaggedE1
  152. SameLevel2BothTaggedE2
  153. }
  154. type SameLevel2NoTagsDE1 struct {
  155. F1 int32
  156. }
  157. type SameLevel2NoTagsE1 struct {
  158. SameLevel2NoTagsDE1
  159. }
  160. type SameLevel2NoTagsDE2 struct {
  161. F1 int32
  162. }
  163. type SameLevel2NoTagsE2 struct {
  164. SameLevel2NoTagsDE2
  165. }
  166. type SameLevel2NoTags struct {
  167. SameLevel2NoTagsE1
  168. SameLevel2NoTagsE2
  169. }
  170. // DoubleEmbedded1 TEST ONLY
  171. type SameLevel2TaggedDE1 struct {
  172. F1 int32
  173. }
  174. // Embedded1 TEST ONLY
  175. type SameLevel2TaggedE1 struct {
  176. SameLevel2TaggedDE1
  177. }
  178. // DoubleEmbedded2 TEST ONLY
  179. type SameLevel2TaggedDE2 struct {
  180. F1 int32 `json:"F1"`
  181. }
  182. // Embedded2 TEST ONLY
  183. type SameLevel2TaggedE2 struct {
  184. SameLevel2TaggedDE2
  185. }
  186. type SameLevel2Tagged struct {
  187. SameLevel2TaggedE1
  188. SameLevel2TaggedE2
  189. }
  190. type EmbeddedPtrO1 struct {
  191. O1F string
  192. }
  193. type EmbeddedPtrOption struct {
  194. O1 *EmbeddedPtrO1
  195. }
  196. type EmbeddedPtr struct {
  197. EmbeddedPtrOption `json:","`
  198. }
  199. type UnnamedLiteral struct {
  200. _ struct{}
  201. }