github.com/bytedance/mockey@v1.2.10/mock_generics_test.go (about) 1 //go:build go1.18 2 // +build go1.18 3 4 /* 5 * Copyright 2022 ByteDance Inc. 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20 package mockey 21 22 import ( 23 "fmt" 24 "reflect" 25 "testing" 26 27 "github.com/smartystreets/goconvey/convey" 28 ) 29 30 func sum[T int | float64](l, r T) T { 31 return l + r 32 } 33 34 type generic[T int | string] struct { 35 a T 36 } 37 38 func (g generic[T]) Value() T { 39 return g.a 40 } 41 42 func (g generic[T]) Value2(hint string) T { 43 return g.a + g.a 44 } 45 46 func TestGeneric(t *testing.T) { 47 PatchConvey("generic", t, func() { 48 PatchConvey("func", func() { 49 arg1, arg2 := 1, 2 50 MockGeneric(sum[int]).To(func(a, b int) int { 51 convey.So(a, convey.ShouldEqual, arg1) 52 convey.So(b, convey.ShouldEqual, arg2) 53 return 999 54 }).Build() 55 convey.So(sum[int](1, 2), convey.ShouldEqual, 999) 56 57 MockGeneric(sum[float64]).Return(888).Build() 58 convey.So(sum[float64](1, 2), convey.ShouldEqual, 888) 59 }) 60 PatchConvey("type", func() { 61 Mock((generic[int]).Value, OptGeneric).Return(999).Build() 62 gi := generic[int]{a: 123} 63 convey.So(gi.Value(), convey.ShouldEqual, 999) 64 65 arg1 := "hint" 66 Mock(GetMethod(generic[string]{}, "Value2"), OptGeneric).To(func(hint string) string { 67 convey.So(hint, convey.ShouldEqual, arg1) 68 return "mock" 69 }).Build() 70 gs := generic[string]{a: "abc"} 71 convey.So(gi.Value(), convey.ShouldEqual, 999) 72 convey.So(gs.Value2(arg1), convey.ShouldEqual, "mock") 73 }) 74 }) 75 } 76 77 type Large15[T any] struct { 78 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ T 79 } 80 81 func TestGenericArg(t *testing.T) { 82 PatchConvey("args", t, func() { 83 GenericArgRunner[uint8]("uint8") 84 GenericArgRunner[uint16]("uint16") 85 GenericArgRunner[uint32]("uint32") 86 GenericArgRunner[uint64]("uint64") 87 GenericArgRunner[Large15[int]]("large15[int]") 88 GenericArgRunner[Large15[Large15[int]]]("Large15[Large15[int]") 89 GenericArgRunner[Large15[Large15[[100]byte]]]("Large15[Large15[[100]byte]") 90 }) 91 } 92 93 func TestGenericRet(t *testing.T) { 94 PatchConvey("rets", t, func() { 95 GenericRetRunner[uint8]("uint8") 96 GenericRetRunner[uint16]("uint16") 97 GenericRetRunner[uint32]("uint32") 98 GenericRetRunner[uint64]("uint64") 99 GenericRetRunner[Large15[int]]("large15[int]") 100 GenericRetRunner[Large15[Large15[int]]]("Large15[Large15[int]") 101 GenericRetRunner[Large15[Large15[[100]byte]]]("Large15[Large15[[100]byte]") 102 }) 103 } 104 105 func TestGenericArgRet(t *testing.T) { 106 PatchConvey("args-rets", t, func() { 107 GenericArgRetRunner[uint8]("uint8") 108 GenericArgRetRunner[uint16]("uint16") 109 GenericArgRetRunner[uint32]("uint32") 110 GenericArgRetRunner[uint64]("uint64") 111 GenericArgRetRunner[Large15[int]]("large15[int]") 112 GenericArgRetRunner[Large15[Large15[int]]]("Large15[Large15[int]") 113 GenericArgRetRunner[Large15[Large15[[100]byte]]]("Large15[Large15[[100]byte]") 114 }) 115 } 116 117 func TestGenericArgValues(t *testing.T) { 118 PatchConvey("args-value", t, func() { 119 PatchConvey("single", func() { 120 var arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15 uintptr = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 121 MockGeneric(GenericsArg15[uintptr]).To(func(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15 uintptr) { 122 convey.So(_1, convey.ShouldEqual, arg1) 123 convey.So(_2, convey.ShouldEqual, arg2) 124 convey.So(_3, convey.ShouldEqual, arg3) 125 convey.So(_4, convey.ShouldEqual, arg4) 126 convey.So(_5, convey.ShouldEqual, arg5) 127 convey.So(_6, convey.ShouldEqual, arg6) 128 convey.So(_7, convey.ShouldEqual, arg7) 129 convey.So(_8, convey.ShouldEqual, arg8) 130 convey.So(_9, convey.ShouldEqual, arg9) 131 convey.So(_10, convey.ShouldEqual, arg10) 132 convey.So(_11, convey.ShouldEqual, arg11) 133 convey.So(_12, convey.ShouldEqual, arg12) 134 convey.So(_13, convey.ShouldEqual, arg13) 135 convey.So(_14, convey.ShouldEqual, arg14) 136 convey.So(_15, convey.ShouldEqual, arg15) 137 }).Build() 138 GenericsArg15(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15) 139 }) 140 PatchConvey("complex", func() { 141 var arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15 string = "1", "2", "3", "4", "5", " 6", "7", "8", "9", "10", "11", "12", "13", "14", "15" 142 MockGeneric(GenericsArg15[string]).To(func(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15 string) { 143 convey.So(_1, convey.ShouldEqual, arg1) 144 convey.So(_2, convey.ShouldEqual, arg2) 145 convey.So(_3, convey.ShouldEqual, arg3) 146 convey.So(_4, convey.ShouldEqual, arg4) 147 convey.So(_5, convey.ShouldEqual, arg5) 148 convey.So(_6, convey.ShouldEqual, arg6) 149 convey.So(_7, convey.ShouldEqual, arg7) 150 convey.So(_8, convey.ShouldEqual, arg8) 151 convey.So(_9, convey.ShouldEqual, arg9) 152 convey.So(_10, convey.ShouldEqual, arg10) 153 convey.So(_11, convey.ShouldEqual, arg11) 154 convey.So(_12, convey.ShouldEqual, arg12) 155 convey.So(_13, convey.ShouldEqual, arg13) 156 convey.So(_14, convey.ShouldEqual, arg14) 157 convey.So(_15, convey.ShouldEqual, arg15) 158 }).Build() 159 GenericsArg15(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15) 160 }) 161 PatchConvey("args-type", func() { 162 target := GenericsTemplate[int, float32, string, chan (int), []byte, struct{ _ int }] 163 MockGeneric(target).To( 164 func(info GenericInfo, t1 int, t2 float32, t3 string) (r1 chan (int), r2 []byte, r3 struct{ _ int }) { 165 convey.So(info.UsedParamType(0), convey.ShouldEqual, reflect.TypeOf(t1)) 166 convey.So(info.UsedParamType(1), convey.ShouldEqual, reflect.TypeOf(t2)) 167 convey.So(info.UsedParamType(2), convey.ShouldEqual, reflect.TypeOf(t3)) 168 convey.So(info.UsedParamType(3), convey.ShouldEqual, reflect.TypeOf(r1)) 169 convey.So(info.UsedParamType(4), convey.ShouldEqual, reflect.TypeOf(r2)) 170 convey.So(info.UsedParamType(5), convey.ShouldEqual, reflect.TypeOf(r3)) 171 return 172 }).Build() 173 target(1, 2, "3") 174 }) 175 }) 176 } 177 178 func GenericsTemplate[T1, T2, T3, R1, R2, R3 any](t1 T1, t2 T2, t3 T3) (r1 R1, r2 R2, r3 R3) { 179 fmt.Println(t1, t2, t3, r1, r2, r3) 180 panic("not here") 181 } 182 183 func GenericsArg0[T any]() { panic("0") } 184 func GenericsArg1[T any](_ T) { panic("1") } 185 func GenericsArg2[T any](_, _ T) { panic("2") } 186 func GenericsArg3[T any](_, _, _ T) { panic("3") } 187 func GenericsArg4[T any](_, _, _, _ T) { panic("4") } 188 func GenericsArg5[T any](_, _, _, _, _ T) { panic("5") } 189 func GenericsArg6[T any](_, _, _, _, _, _ T) { panic("6") } 190 func GenericsArg7[T any](_, _, _, _, _, _, _ T) { panic("7") } 191 func GenericsArg8[T any](_, _, _, _, _, _, _, _ T) { panic("8") } 192 func GenericsArg9[T any](_, _, _, _, _, _, _, _, _ T) { panic("9") } 193 func GenericsArg10[T any](_, _, _, _, _, _, _, _, _, _ T) { panic("10") } 194 func GenericsArg11[T any](_, _, _, _, _, _, _, _, _, _, _ T) { panic("11") } 195 func GenericsArg12[T any](_, _, _, _, _, _, _, _, _, _, _, _ T) { panic("12") } 196 func GenericsArg13[T any](_, _, _, _, _, _, _, _, _, _, _, _, _ T) { panic("13") } 197 func GenericsArg14[T any](_, _, _, _, _, _, _, _, _, _, _, _, _, _ T) { panic("14") } 198 func GenericsArg15[T any](_, _, _, _, _, _, _, _, _, _, _, _, _, _, _ T) { 199 panic("15") 200 } 201 202 func GenericArgRunner[T any](name string) { 203 // type T = context.Context 204 var arg T 205 206 PatchConvey(name, func() { 207 MockGeneric(GenericsArg0[T]).Return().Build() 208 MockGeneric(GenericsArg1[T]).Return().Build() 209 MockGeneric(GenericsArg2[T]).Return().Build() 210 MockGeneric(GenericsArg3[T]).Return().Build() 211 MockGeneric(GenericsArg4[T]).Return().Build() 212 MockGeneric(GenericsArg5[T]).Return().Build() 213 MockGeneric(GenericsArg6[T]).Return().Build() 214 MockGeneric(GenericsArg7[T]).Return().Build() 215 MockGeneric(GenericsArg8[T]).Return().Build() 216 MockGeneric(GenericsArg9[T]).Return().Build() 217 MockGeneric(GenericsArg10[T]).Return().Build() 218 MockGeneric(GenericsArg11[T]).Return().Build() 219 MockGeneric(GenericsArg12[T]).Return().Build() 220 MockGeneric(GenericsArg13[T]).Return().Build() 221 MockGeneric(GenericsArg14[T]).Return().Build() 222 MockGeneric(GenericsArg15[T]).Return().Build() 223 convey.So(func() { GenericsArg0[T]() }, convey.ShouldNotPanic) 224 convey.So(func() { GenericsArg1(arg) }, convey.ShouldNotPanic) 225 convey.So(func() { GenericsArg2(arg, arg) }, convey.ShouldNotPanic) 226 convey.So(func() { GenericsArg3(arg, arg, arg) }, convey.ShouldNotPanic) 227 convey.So(func() { GenericsArg4(arg, arg, arg, arg) }, convey.ShouldNotPanic) 228 convey.So(func() { GenericsArg5(arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 229 convey.So(func() { GenericsArg6(arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 230 convey.So(func() { GenericsArg7(arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 231 convey.So(func() { GenericsArg8(arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 232 convey.So(func() { GenericsArg9(arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 233 convey.So(func() { GenericsArg10(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 234 convey.So(func() { GenericsArg11(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 235 convey.So(func() { GenericsArg12(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 236 convey.So(func() { GenericsArg13(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 237 convey.So(func() { GenericsArg14(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 238 convey.So(func() { GenericsArg15(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 239 }) 240 241 convey.So(func() { GenericsArg0[T]() }, convey.ShouldPanic) 242 convey.So(func() { GenericsArg1(arg) }, convey.ShouldPanic) 243 convey.So(func() { GenericsArg2(arg, arg) }, convey.ShouldPanic) 244 convey.So(func() { GenericsArg3(arg, arg, arg) }, convey.ShouldPanic) 245 convey.So(func() { GenericsArg4(arg, arg, arg, arg) }, convey.ShouldPanic) 246 convey.So(func() { GenericsArg5(arg, arg, arg, arg, arg) }, convey.ShouldPanic) 247 convey.So(func() { GenericsArg6(arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 248 convey.So(func() { GenericsArg7(arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 249 convey.So(func() { GenericsArg8(arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 250 convey.So(func() { GenericsArg9(arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 251 convey.So(func() { GenericsArg10(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 252 convey.So(func() { GenericsArg11(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 253 convey.So(func() { GenericsArg12(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 254 convey.So(func() { GenericsArg13(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 255 convey.So(func() { GenericsArg14(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 256 convey.So(func() { GenericsArg15(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 257 } 258 259 func GenericsRet0[T any]() { panic("0") } 260 func GenericsRet1[T any]() (_ T) { panic("1") } 261 func GenericsRet2[T any]() (_, _ T) { panic("2") } 262 func GenericsRet3[T any]() (_, _, _ T) { panic("3") } 263 func GenericsRet4[T any]() (_, _, _, _ T) { panic("4") } 264 func GenericsRet5[T any]() (_, _, _, _, _ T) { panic("5") } 265 func GenericsRet6[T any]() (_, _, _, _, _, _ T) { panic("6") } 266 func GenericsRet7[T any]() (_, _, _, _, _, _, _ T) { panic("7") } 267 func GenericsRet8[T any]() (_, _, _, _, _, _, _, _ T) { panic("8") } 268 func GenericsRet9[T any]() (_, _, _, _, _, _, _, _, _ T) { panic("9") } 269 func GenericsRet10[T any]() (_, _, _, _, _, _, _, _, _, _ T) { panic("10") } 270 func GenericsRet11[T any]() (_, _, _, _, _, _, _, _, _, _, _ T) { panic("11") } 271 func GenericsRet12[T any]() (_, _, _, _, _, _, _, _, _, _, _, _ T) { panic("12") } 272 func GenericsRet13[T any]() (_, _, _, _, _, _, _, _, _, _, _, _, _ T) { panic("13") } 273 func GenericsRet14[T any]() (_, _, _, _, _, _, _, _, _, _, _, _, _, _ T) { 274 panic("14") 275 } 276 277 func GenericsRet15[T any]() (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _ T) { 278 panic("15") 279 } 280 281 func GenericRetRunner[T any](name string) { 282 var arg T 283 PatchConvey(name, func() { 284 MockGeneric(GenericsRet0[T]).Return().Build() 285 MockGeneric(GenericsRet1[T]).Return(arg).Build() 286 MockGeneric(GenericsRet2[T]).Return(arg, arg).Build() 287 MockGeneric(GenericsRet3[T]).Return(arg, arg, arg).Build() 288 MockGeneric(GenericsRet4[T]).Return(arg, arg, arg, arg).Build() 289 MockGeneric(GenericsRet5[T]).Return(arg, arg, arg, arg, arg).Build() 290 MockGeneric(GenericsRet6[T]).Return(arg, arg, arg, arg, arg, arg).Build() 291 MockGeneric(GenericsRet7[T]).Return(arg, arg, arg, arg, arg, arg, arg).Build() 292 MockGeneric(GenericsRet8[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg).Build() 293 MockGeneric(GenericsRet9[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg, arg).Build() 294 MockGeneric(GenericsRet10[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg).Build() 295 MockGeneric(GenericsRet11[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg).Build() 296 MockGeneric(GenericsRet12[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg).Build() 297 MockGeneric(GenericsRet13[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg).Build() 298 MockGeneric(GenericsRet14[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg).Build() 299 MockGeneric(GenericsRet15[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg).Build() 300 convey.So(func() { GenericsRet0[T]() }, convey.ShouldNotPanic) 301 convey.So(func() { GenericsRet1[T]() }, convey.ShouldNotPanic) 302 convey.So(func() { GenericsRet2[T]() }, convey.ShouldNotPanic) 303 convey.So(func() { GenericsRet3[T]() }, convey.ShouldNotPanic) 304 convey.So(func() { GenericsRet4[T]() }, convey.ShouldNotPanic) 305 convey.So(func() { GenericsRet5[T]() }, convey.ShouldNotPanic) 306 convey.So(func() { GenericsRet6[T]() }, convey.ShouldNotPanic) 307 convey.So(func() { GenericsRet7[T]() }, convey.ShouldNotPanic) 308 convey.So(func() { GenericsRet8[T]() }, convey.ShouldNotPanic) 309 convey.So(func() { GenericsRet9[T]() }, convey.ShouldNotPanic) 310 convey.So(func() { GenericsRet10[T]() }, convey.ShouldNotPanic) 311 convey.So(func() { GenericsRet11[T]() }, convey.ShouldNotPanic) 312 convey.So(func() { GenericsRet12[T]() }, convey.ShouldNotPanic) 313 convey.So(func() { GenericsRet13[T]() }, convey.ShouldNotPanic) 314 convey.So(func() { GenericsRet14[T]() }, convey.ShouldNotPanic) 315 convey.So(func() { GenericsRet15[T]() }, convey.ShouldNotPanic) 316 }) 317 318 convey.So(func() { GenericsRet0[T]() }, convey.ShouldPanic) 319 convey.So(func() { GenericsRet1[T]() }, convey.ShouldPanic) 320 convey.So(func() { GenericsRet2[T]() }, convey.ShouldPanic) 321 convey.So(func() { GenericsRet3[T]() }, convey.ShouldPanic) 322 convey.So(func() { GenericsRet4[T]() }, convey.ShouldPanic) 323 convey.So(func() { GenericsRet5[T]() }, convey.ShouldPanic) 324 convey.So(func() { GenericsRet6[T]() }, convey.ShouldPanic) 325 convey.So(func() { GenericsRet7[T]() }, convey.ShouldPanic) 326 convey.So(func() { GenericsRet8[T]() }, convey.ShouldPanic) 327 convey.So(func() { GenericsRet9[T]() }, convey.ShouldPanic) 328 convey.So(func() { GenericsRet10[T]() }, convey.ShouldPanic) 329 convey.So(func() { GenericsRet11[T]() }, convey.ShouldPanic) 330 convey.So(func() { GenericsRet12[T]() }, convey.ShouldPanic) 331 convey.So(func() { GenericsRet13[T]() }, convey.ShouldPanic) 332 convey.So(func() { GenericsRet14[T]() }, convey.ShouldPanic) 333 convey.So(func() { GenericsRet15[T]() }, convey.ShouldPanic) 334 } 335 336 func GenericsArgRet0[T any]() { panic("0") } 337 func GenericsArgRet1[T any](_ T) (_ T) { panic("1") } 338 func GenericsArgRet2[T any](_, _ T) (_, _ T) { panic("2") } 339 func GenericsArgRet3[T any](_, _, _ T) (_, _, _ T) { panic("3") } 340 func GenericsArgRet4[T any](_, _, _, _ T) (_, _, _, _ T) { panic("4") } 341 func GenericsArgRet5[T any](_, _, _, _, _ T) (_, _, _, _, _ T) { panic("5") } 342 func GenericsArgRet6[T any](_, _, _, _, _, _ T) (_, _, _, _, _, _ T) { panic("6") } 343 func GenericsArgRet7[T any](_, _, _, _, _, _, _ T) (_, _, _, _, _, _, _ T) { 344 panic("7") 345 } 346 347 func GenericsArgRet8[T any](_, _, _, _, _, _, _, _ T) (_, _, _, _, _, _, _, _ T) { 348 panic("8") 349 } 350 351 func GenericsArgRet9[T any](_, _, _, _, _, _, _, _, _ T) (_, _, _, _, _, _, _, _, _ T) { 352 panic("9") 353 } 354 355 func GenericsArgRet10[T any](_, _, _, _, _, _, _, _, _, _ T) (_, _, _, _, _, _, _, _, _, _ T) { 356 panic("10") 357 } 358 359 func GenericsArgRet11[T any](_, _, _, _, _, _, _, _, _, _, _ T) (_, _, _, _, _, _, _, _, _, _, _ T) { 360 panic("11") 361 } 362 363 func GenericsArgRet12[T any](_, _, _, _, _, _, _, _, _, _, _, _ T) (_, _, _, _, _, _, _, _, _, _, _, _ T) { 364 panic("12") 365 } 366 367 func GenericsArgRet13[T any](_, _, _, _, _, _, _, _, _, _, _, _, _ T) (_, _, _, _, _, _, _, _, _, _, _, _, _ T) { 368 panic("13") 369 } 370 371 func GenericsArgRet14[T any](_, _, _, _, _, _, _, _, _, _, _, _, _, _ T) (_, _, _, _, _, _, _, _, _, _, _, _, _, _ T) { 372 panic("14") 373 } 374 375 func GenericsArgRet15[T any](_, _, _, _, _, _, _, _, _, _, _, _, _, _, _ T) (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _ T) { 376 panic("15") 377 } 378 379 func GenericArgRetRunner[T any](name string) { 380 var arg T 381 PatchConvey(name, func() { 382 MockGeneric(GenericsArgRet0[T]).Return().Build() 383 MockGeneric(GenericsArgRet1[T]).Return(arg).Build() 384 MockGeneric(GenericsArgRet2[T]).Return(arg, arg).Build() 385 MockGeneric(GenericsArgRet3[T]).Return(arg, arg, arg).Build() 386 MockGeneric(GenericsArgRet4[T]).Return(arg, arg, arg, arg).Build() 387 MockGeneric(GenericsArgRet5[T]).Return(arg, arg, arg, arg, arg).Build() 388 MockGeneric(GenericsArgRet6[T]).Return(arg, arg, arg, arg, arg, arg).Build() 389 MockGeneric(GenericsArgRet7[T]).Return(arg, arg, arg, arg, arg, arg, arg).Build() 390 MockGeneric(GenericsArgRet8[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg).Build() 391 MockGeneric(GenericsArgRet9[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg, arg).Build() 392 MockGeneric(GenericsArgRet10[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg).Build() 393 MockGeneric(GenericsArgRet11[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg).Build() 394 MockGeneric(GenericsArgRet12[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg).Build() 395 MockGeneric(GenericsArgRet13[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg).Build() 396 MockGeneric(GenericsArgRet14[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg).Build() 397 MockGeneric(GenericsArgRet15[T]).Return(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg).Build() 398 convey.So(func() { GenericsArgRet0[T]() }, convey.ShouldNotPanic) 399 convey.So(func() { GenericsArgRet1(arg) }, convey.ShouldNotPanic) 400 convey.So(func() { GenericsArgRet2(arg, arg) }, convey.ShouldNotPanic) 401 convey.So(func() { GenericsArgRet3(arg, arg, arg) }, convey.ShouldNotPanic) 402 convey.So(func() { GenericsArgRet4(arg, arg, arg, arg) }, convey.ShouldNotPanic) 403 convey.So(func() { GenericsArgRet5(arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 404 convey.So(func() { GenericsArgRet6(arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 405 convey.So(func() { GenericsArgRet7(arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 406 convey.So(func() { GenericsArgRet8(arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 407 convey.So(func() { GenericsArgRet9(arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 408 convey.So(func() { GenericsArgRet10(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 409 convey.So(func() { GenericsArgRet11(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 410 convey.So(func() { GenericsArgRet12(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 411 convey.So(func() { GenericsArgRet13(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 412 convey.So(func() { GenericsArgRet14(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 413 convey.So(func() { GenericsArgRet15(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldNotPanic) 414 }) 415 416 convey.So(func() { GenericsArgRet0[T]() }, convey.ShouldPanic) 417 convey.So(func() { GenericsArgRet1(arg) }, convey.ShouldPanic) 418 convey.So(func() { GenericsArgRet2(arg, arg) }, convey.ShouldPanic) 419 convey.So(func() { GenericsArgRet3(arg, arg, arg) }, convey.ShouldPanic) 420 convey.So(func() { GenericsArgRet4(arg, arg, arg, arg) }, convey.ShouldPanic) 421 convey.So(func() { GenericsArgRet5(arg, arg, arg, arg, arg) }, convey.ShouldPanic) 422 convey.So(func() { GenericsArgRet6(arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 423 convey.So(func() { GenericsArgRet7(arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 424 convey.So(func() { GenericsArgRet8(arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 425 convey.So(func() { GenericsArgRet9(arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 426 convey.So(func() { GenericsArgRet10(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 427 convey.So(func() { GenericsArgRet11(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 428 convey.So(func() { GenericsArgRet12(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 429 convey.So(func() { GenericsArgRet13(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 430 convey.So(func() { GenericsArgRet14(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 431 convey.So(func() { GenericsArg15(arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg, arg) }, convey.ShouldPanic) 432 }